local parent = script.Parent function steppedOn(part) if game.Players:GetPlayerFromCharacter(parent) then parent.TeamColor = "Bright Green" parent.Humanoid.Health = 0 end end script.Parent.Touched:connect(steppedOn)
So basically what I am trying to get it to do is when it is touched it changes your player to Team: "Level 2", and the Team Color is Bright Green. And then kills the player so it will get re-spawned at the next level. But I get no errors, and it doesn't seem to work. But If I take out the
parent.TeamColor = "Bright Green"
then it will kill the player. So I can't really find out what is wrong with it. And help would be appreciated. :)
Thanks, Awesomespyhacker12
Well, you used the TouchedEvent a bit wrong. I'll comment throughout my script!
script.Parent.Touched:connect(function(hit) -- The Touched Event if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then -- Checks if it's a player. local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Sets a variable for the player player.TeamColor = BrickColor.new("Bright green") -- Changes their Teamcolor to Bright green player.Character:BreakJoints() -- Another form of resetting their character end end)
local parent = script.Parent function steppedOn(part) if game.Players:GetPlayerFromCharacter(parent) then parent.TeamColor = BrickColor.new("Bright green") -- Forgot to add BrickColor.new and green was capped parent.Humanoid.Health = 0 end end script.Parent.Touched:connect(steppedOn)
Try that lol
Locked by YellowoTide, ImageLabel, and NotsoPenguin
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?