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

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

Asked by
TZ_Gun 0
6 years ago

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.

0
Is filtering enabled on? If yes, then you need to use a remote event/function. Golubian 37 — 6y
0
FE isn't on. TZ_Gun 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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

0
This script fully working, just little note: Ulysse94 0 — 5y
Ad

Answer this question