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

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

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

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.

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