So I want to make a brick change color when someone steps on it and i cant get it to work I have tried this
when onTouch(hit)
function
Light.Color = Color3.new(255/255, 0/255, 0/255) -- Red
end
end
Will someone help?
So I want to make a brick change color when someone steps on it and i cant get it to work I have tried this
when onTouch(hit)
function
Light.Color = Color3.new(255/255, 0/255, 0/255) -- Red
end
end
Will someone help?
I suggest learning more on how to script on the Roblox Wiki, as that is not how you use a function correctly.
script.Parent.Touched:Connect(function() --When the part is touched
script.Parent.Color = Color3.new(255/255,0/255,0/255) --Change the parts color
end)
Please accept my answer if this helped!
Lol why are you dividing 0 by 255 there's no point in doing that, also you can use Color3.fromRgb() which lets you input a number between 0 and 255 instead of 0 and 1.
Thx This Helped!
@LifeInDevelopment there is a point actually.
@ReadySetGo2929 please accept my answer!
poor him ^ XDDDDDDDDDDDDDDDDDDD
I wish I could delete comments on my answer.
This discussion is preserved as it was. New answers, comments, and votes are closed.
5 comments
"when" is an unknown global word, try "function onTouch(hit)"
for line 2, put down "script.Parent.BrickColor= BrickColor.new("Really red")"
and then for line 3.. put down "end" then on line 4.. "script.Parent.Touched:connect(onTouch) basically, rewrite the whole script.
https://pastebin.com/MvBPe10A script is in here
Why are you doing Color3.new(255/ 255, 0/255, 0/255) if you are using simple numbers? You would know that you could use Color3.new(1, 0, 0) or Color3.fromRGB(255, 0, 0).