I've tried to reformat the script so it would work but I still have no luck, I'm trying to make a script the teleports a player to a certain location if they're on Red Team but to different coordinates if they're on Blue Team, any suggestions? function Click() This is where the error is V if script.Parent.MouseButtonDown:connect(Click) and player.team = BrickColor.Red then script.Parent.Parent.Parent.Parent.Character.HumanoidRootPart.CFrame = CFrame.new(-13.2, 0.5, -35.27)
else if script.Parent.MouseButtonDown:connect(Click) and player.team = BrickColor.Blue script.Parent.Parent.Parent.Parent.Character.HumanoidRootPart.CFrame = CFrame.new(-13.2, 0.5, -35.27) end end
Please. Format your script so we can read it properly.
The error here is pretty self-explanatory. You said:
if script.Parent.MouseButton1Down:Connect(Click) and player.team = BrickColor.Red then
In the second part of the statement, you are assigning player.team
to BrickColor.Red
by using a single equal sign.
If you want to perform a comparison, use two equal signs.
if script.Parent.MouseButton1Down:Connect(Click) and player.team == BrickColor.Red then
Hope this helps :)
P.S.
Use variables rather than writing .Parent.Parent.Parent... a bunch of times.
local part = script.Parent.Parent part.Name = "Part that correctly uses variables"
And use Connect
rather than connect
.
The Error "Expected Then but got =" Means that you are missing a "Then"
How To Fix it?
It is really easy to fix this error. Simply add a "then"
Because if you have an "If" sentence you need to add a "Then" to justify what to do when it matches the "If" Sentence.
For example If Part.BrickColor = Red
Then Part.Transparency = 1
[Not The Best At Giving Example]
To fix your script, simply add Then
After BrickColor.Blue
Here is the Script
else if script.Parent.MouseButtonDown:connect(Click) and player.team = BrickColor.Blue then script.Parent.Parent.Parent.Parent.Character.HumanoidRootPart.CFrame = CFrame.new(-13.2, 0.5, -35.27) end end
Hope This Helps.
And Please Format your script correctly, so it's easier for others to read and fix your script!
Have Fun scripting!