Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
Punctist 120
3 years ago

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)
Ad

Answer this question