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

This always makes the brick(Bruh) turn blue no matter what your name is what wrong?

Asked by 10 years ago

function onTouch(hit) if hit.Parent.Name=="Player2" or "Terrain" then game.Workspace.Bruh.BrickColor = BrickColor.new('Blue') else msg=Instance.new('Message', game.Workspace) msg.Text='You are not player one, So I'..'m '..'not '..'turning blue for you' wait(2) Message:Destroy()

end end script.Parent.Touched:connect(onTouch)~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~

0
Please edit your post to fix your code formatting. One row of the tildes (~ symbol) should be before and one row after. BlueTaslem 18071 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

There are 2 mistakes in your script.

1) The line

if hit.Parent.Name == "Player2" or "Terrain" then

should be

if hit.Parent.Name == "Player2" or hit.Parent.Name == "Terrain" then

2) When you destroyed the "Message" object, you did it wrong. You assigned the "Message" object to be the value of msg (variable) so instead of:

Message:Destroy()

it should be

msg:Destroy()

I hope this fixed the problem.

I don't understand why did you close the quotes in the message's text so many times if there is no concatenation that needs to be done.

Ad

Answer this question