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

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

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


1 comment

0

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

1 answer

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
  1. 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.

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