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

My Team change script isn't working, I was wondering why, and how can I fix it?

Asked by 7 years ago
Edited 7 years ago

I have a GUI that is supposed to change a player's team, but it doesn't. Here is my script, but note, I am new to scripting, so anything obvious to you is not so clear to me.




if script.Parent.Rebel.MouseButton1Down:Connect(function() game.Players.LocalPlayer.TeamColor = game:GetService("Teams")["The Resistance"].TeamColor end)

It's error log says this: 17:29:04.163 - Players.Player1.PlayerGui.ScreenGui.Frame.Rebel.LocalScript:4: 'then' expected near '<eof>'

Thanks in Advance!

2 answers

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
7 years ago

Remove the if at the start, since this is a function not any kind of evaluation. BTW you are better off setting Team it is the same thing.

script.Parent.ChoseRebel.MouseButton1Down:Connect(function()
    game.Players.LocalPlayer.Team = game:GetService("Teams")["The Resistance"]
end)
0
This didn't work for some reason, even after I corrected the parent button's name (Derp, It changed from ChoseRebel to Rebel), any clue? No Error log either, strange... 121049707 0 — 7y
0
What do you mean it doesn't work. The code running without errors means it works. cabbler 1942 — 7y
0
it didn't change my team 121049707 0 — 7y
0
then click the button cabbler 1942 — 7y
Ad
Log in to vote
0
Answered by
uhTeddy 101
7 years ago

You should remove the if and instead of doing game:GetService("Teams")["The Resistance"] do BrickColor.new([Your team color])

It should look like this

script.Parent.ChoseRebel.MouseButton1Down:Connect(function()
    game.Players.LocalPlayer.Team = BrickColor.new("Lapis")
end)

That is an example change Lapis to the color of the team.

0
Nope, won't work, atleast in Studio 121049707 0 — 7y
0
Ohh You need to change LocalPlayer to something else if your in a Gut so the `Parent` tecnique uhTeddy 101 — 7y

Answer this question