local team = game.Teams.Lobby local function ontouch(part) local hum = part.Parent:FindFirstChild("Humanoid") local players = game.Players:GetChildren() if players then if hum then players.Teams = game.Teams.Lobby hum.Health = 0 end end end script.Parent.Touched:connect(ontouch)
IDK whats the problem here.
You added an s to the property Team
. It's also best to use GetPlayerFromCharacter
, as it's shorter.
script.Parent.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) --gets the players' character if player then --if the player touched it then player.Team = game.Teams.Lobby --change the team player.Character.Humanoid.Health = 0 --get the humanoid and set it's health to 0 else return end end)
Please accept my answer if this helped!
You need to define the actual player, not just list. Team should be TeamColor
local team = game.Teams.Lobby local function ontouch(part) local hum = part.Parent:FindFirstChild("Humanoid") local player = game.Players:findFirstChild(hum.Parent.Name) if hum then if player then player.TeamColor = team.TeamColor hum.Health = 0 end end end script.Parent.Touched:connect(ontouch)
That will change the Team of the player who touches the brick.
Let me know if this isn't the solution you were looking for.