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

Brick changing colour on touch?

Asked by 7 years ago
Edited 7 years ago

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?

0
"when" is an unknown global word, try "function onTouch(hit)" AirTranPilot22 2 — 7y
0
for line 2, put down "script.Parent.BrickColor= BrickColor.new("Really red")" AirTranPilot22 2 — 7y
0
and then for line 3.. put down "end" then on line 4.. "script.Parent.Touched:connect(onTouch) basically, rewrite the whole script. AirTranPilot22 2 — 7y
0
https://pastebin.com/MvBPe10A script is in here AirTranPilot22 2 — 7y
0
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). hiimgoodpack 2009 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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!

0
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. LifeInDevelopment 364 — 7y
0
Thx This Helped! ReadySetGo2929 5 — 7y
0
@LifeInDevelopment there is a point actually. PyccknnXakep 1225 — 7y
0
@ReadySetGo2929 please accept my answer! PyccknnXakep 1225 — 7y
View all comments (2 more)
0
poor him ^ XDDDDDDDDDDDDDDDDDDD greatneil80 2647 — 7y
0
I wish I could delete comments on my answer. PyccknnXakep 1225 — 7y
Ad

Answer this question