Created
December 29, 2024 21:22
-
-
Save bubu07codes/20121e5b8598e54f4e40949d987eb34c to your computer and use it in GitHub Desktop.
Understand the use of touched event in Roblox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local part = script.Parent -- The Part | |
part.Touched:Connect(function(hit) -- Every time something touches the part | |
print(hit) -- This is the Instance what touched the part | |
if hit:IsA("Part") then -- If the Instance is a Part Type | |
hit.Color = Color3.new(0.5, 0, 1) -- Set the touched Part color to Purple | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment