Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you respawn/kill someone after the player themselves change their team?

Asked by
Yeevivor4 155
8 years ago

Hello, thank you for reading. What I'm trying to do is that after you, Player1, changes your team from Neutral to Red, you'll be automatically respawned/killed.

The other thing is the WarAndPolTime. Basically, it is a timer. The function is that after you change your team, the script will check if you have a IntValue called "WarAndPolTime" in you. If you do, and it's value is not equal to 0 then, the timer will subtract it self until it equals 0.

while true do
    wait()
        Respawn()
            end
function Respawn(player)
repeat wait() until player.Character
    local WarAndPolTime = player:findFirstChild("playerstats").slots.WarAndPolTime
      local character = player.Character;
            if WarAndPolTime.Value > 0 then
            repeat WarAndPolTime.Value = WarAndPolTime.Value - 1 until
            WarAndPolTime.Value == 0
         if (character) then
           if character.Humanoid.Health then
             character.Humanoid.Health = 0
            end
            end
    end
end

Answer this question