Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a part that changecolor every sec when your on the block but stops when ur not on it?

I know it requires a function with a touched event but i'm wondering if it requires and if statement or while true do loop or repeat and until. Please show me how.

1 answer

✓ Accepted answer

Hey! Insert a serverscript inside the part you want to change color of. After that go inside the script and paste this in. Should work! :)

local debounce = false
script.Parent.Touched:Connect(function(hit)
	if debounce == false then
		debounce = true
	if hit.Parent:FindFirstChild("Humanoid") then
			script.Parent.BrickColor = BrickColor.Random()
		end
		wait(1)
		debounce = false
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.