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

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

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

✓ Accepted answer

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.

5 comments

0

thanks. line by line, the comments explain what i'm trying to do.

0

also, Instance.new("Hint") IS a thing on ROBLOX. i know, because i played around with it in the command bar in Studio.

0

Well it's deprecated that's why it doesn't show up for me

0

Use a TextLabel. But you need to parent the TextLabel to ScreenGui which is parent to PlayerGui in the PlayerObject

0

yeah

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