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

Why does my goal script error saying "unexpected symbol"?

Asked by 2 years ago

I'm trying to create a goal in ROBLOX:

db = false -- We make this variable, so that we can make sure Bright red Team doesn't instantly make Bright blue Team lose more than 1 point by just 1 Kick Off.

script.Parent.Touched:connect(function(hit) -- When the script's parent (BlueGoal) is touched
if hit and hit.Name == "Ball" and db == false then -- We need to know if the debounce is off, and if the part that touched BlueGoal is named 'Ball'
db = true -- Turn debounce on, so that for the next 3 seconds we can't lose more than 1 point.
message = Instance.new("Hint").Parent = Workspace -- Add a new Hint to the Workspace so that we know what's going on.
message.Text = "Bright blue Team loses 1 point! Kick Off!" -- Set the Hint's Text accordingly and display the message.
wait(3) -- We wait 3 seconds to make sure everyone can read the message.
message:destroy() -- We hide the message by :destroy()ing it.
db = false -- We turn debounce off again so that we can score more points.
end
end)

The problem is, it errors. :( Workspace.BlueGoal.Script:6: unexpected symbol near '='

Please help.

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

You can't have 2 equal signs on the same line. Also, Instance.new("Hint") is not a thing on Roblox. You should make your variables local like instead of db = false do local db = false

Also, I've heard somewhere that you should set all your properties first and the last thing you should do is parent it which can increase performance.

This script is confusing. Explain what you're trying to do.

0
thanks. line by line, the comments explain what i'm trying to do. Persona3_FES 2 — 2y
0
also, Instance.new("Hint") IS a thing on ROBLOX. i know, because i played around with it in the command bar in Studio. Persona3_FES 2 — 2y
0
Well it's deprecated that's why it doesn't show up for me MarkedTomato 810 — 2y
0
Use a TextLabel. But you need to parent the TextLabel to ScreenGui which is parent to PlayerGui in the PlayerObject MarkedTomato 810 — 2y
0
yeah Persona3_FES 2 — 2y
Ad

Answer this question