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

How can i make this team changer script change your team and your character?

local Player = game.Players.LocalPlayer
local groups = {1198534}

function Click()
	for i, ID in pairs(groups) do
		if Player:IsInGroup(ID) then
			Player.TeamColor = BrickColor.new("Bright red")
			Player:LoadCharacter()
			break
		end
	end
end

script.Parent.MouseButton1Down:connect(Click)

I'm trying to make a team script where instead of it killing you it just respawns you instead. However it only changes your team and doesn't respawn. How can i fix?

1 answer

For the function :LoadCharacter() to work, you must be using a server-script, and by your Line 1 defining player as game.Players.LocalPlayer, it seems to me your using a LocalScript

At the moment, my best solution I can give you off the top of my head is to do this (Not The Best): Move it all to a ServerScript, then define Player through going through a script.Parent pathway,

^ That should work if your script is in a button, which is in a frame/gui, which is in the startergui area.

One example: Your Button/Script Location:

game.Players.Player1.PlayerGui.ScreenGui.TextButton.Script

Now you would have to get to Player1 in that path Use this:

local Player = script.Parent.Parent.Parent.Parent

Like I said, not the best, so try and find a better solution to your problem. Anyways, Hope this helps, Good luck

For more information, use this wiki article

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