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

Team change script doesn't work, Not sure why?

I made a team change GUI following a you tube tutorial. The script isn't working for whatever reason and I can't find why. Can anyone help me please?

player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function() if player:IsInGroup(3632443) then player.TeamColor = BrickColor.new("Shamrock") player:LoadCharacter() end end)

Thanks, Gun.

2 comments

0

Is filtering enabled on? If yes, then you need to use a remote event/function.

0

FE isn't on.

1 answer

After reading your problem, I would like to try to solve your problem. This script would change your team and respawn the player in a different way

-- Local Script
local Player = game.Players.LocalPlayer
local Teams = game:GetService("Teams")

script.Parent.MouseButton1Click:connect(function()
    if Player:IsInGroup(3632443) then
		Player.Team = Teams:FindFirstChild("TEAM") -- Change TEAM for your team name.
		game.ReplicatedStorage.REMOTE_EVENT:FireServer() -- We need a Remote Event to be able to tell the server that we want to respawn.(Change REMOTE_EVENT for your remove event's name.)
	end
end)

-- Script
game.ReplicatedStorage.REMOVE_EVENT.OnServerEvent:connect(function(Player) -- (Change REMOTE_EVENT for your remove event's name.
	Player:LoadCharacter() -- We respawn the player from the server as LoadCharacter can only be called from the server.
end)

References: http://wiki.roblox.com/index.php?title=API:Class/Teams
http://wiki.roblox.com/index.php?title=API:Class/RemoteEvent

Hope that helped.(Sorry for any mistakes, grammar mistakes or bad explanation.)

1 comment

0

This script fully working, just little note:

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