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

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

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

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)

4 comments

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

0

What do you mean it doesn't work. The code running without errors means it works.

0

it didn't change my team

0

then click the button

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.

2 comments

0

Nope, won't work, atleast in Studio

0

Ohh You need to change LocalPlayer to something else if your in a Gut so the Parent tecnique

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