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

Brick changing colour on touch?

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?

5 comments

0

"when" is an unknown global word, try "function onTouch(hit)"

0

for line 2, put down "script.Parent.BrickColor= BrickColor.new("Really red")"

0

and then for line 3.. put down "end" then on line 4.. "script.Parent.Touched:connect(onTouch) basically, rewrite the whole script.

0
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).

1 answer

✓ Accepted answer

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!

6 comments

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.

0

Thx This Helped!

0

@LifeInDevelopment there is a point actually.

0

@ReadySetGo2929 please accept my answer!

0

poor him ^ XDDDDDDDDDDDDDDDDDDD

0

I wish I could delete comments on my answer.

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