i dont want to use spawnlocation
plr = game.Players.LocalPlayer script.Parent.Touched:Connect(function(Hit) plr.Teamcolor = BrickColor.new("Really red") end)
i tested it with script and local script but not working
You can do this with a server script. All you need to do is add a server script and then write the following code:
script.Parent.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then player.TeamColor = BrickColor.new("Team color here") player:LoadCharacter() end end)
Explaining the code:
game.Players:GetPlayerFromCharacter(hit.Parent)
returns the player from the argument passed. If the argument is the character model, the player will be returned. If it is not a character model, this function returns nil
.
Since it can return nil, you check that the player exists. If it does exist, the TeamColor
property is changed to whatever color you specify, them the character is reloaded.