b = script.Parent
function onTouched(plr)
game.Players.LocalPlayer.Team = game.Teams["Blue"]
end
b.Touched:connect(onTouched)
I assume in this case, b would be a part.
When a part is touched, the hit is not the actual player, but a limb of the model of the player in the workspace.
So you end up with
b = script.Parent function onTouched(hit) name = hit.Parent.Name --storing the name of the player you hit for i,v in pairs (game.Players:GetChildren()) do --finding the player in game.Players if v.Name == name then v.Team = place in the team end end end b.Touched:connect(onTouched)
You cannot access LocalPlayer in a ServerScript. The reason it works in studio is because it only has one player, but with servers, they have multiple players. So the server script is just like "What player am I supposed to choose?!" Also, you should use code blocks when displaying code.