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

How to fix this team gui player:LoadCharacter() script?

Asked by 6 years ago
Edited 6 years ago

Does anyone know how to fix this problem?

I have made a team changer GUI and I don't want to "kill" the player instead I just want to load the player in with player:LoadCharacter() if I can. The script will work in studio but it won't in game.

Here is my code.

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
player.TeamColor = BrickColor.new('Really red')
    player:LoadCharacter()
end)

I am using a local script.

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

When using LoadCharacter(), I'd recommend you check the documentation. If you did, you would've saw that This item should be used in a Script to work as expected online.

That said, the way I did this was to fire a remoteevent with the team the person is changing to and have that in a script in ServerScriptService.

Ad

Answer this question