Skip to content

Instantly share code, notes, and snippets.

@bubu07codes
Created December 29, 2024 21:22
Show Gist options
  • Save bubu07codes/20121e5b8598e54f4e40949d987eb34c to your computer and use it in GitHub Desktop.
Save bubu07codes/20121e5b8598e54f4e40949d987eb34c to your computer and use it in GitHub Desktop.
Understand the use of touched event in Roblox
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