Hey guys, I just recently got into scripting. Now I am stuck with an idea I can´t finish, which is creating a fire on a player by letting them step on a part and then give it to someone else, to make them burn and die from it. They also have the chance to give it back, since the fire is timed.
Altough I have absolutly no idea how I am supposed to find the players that can be given fire to.
It´s supposed to work in the mechanic of a game called "hot potato".
fire = true fireinuse = false Firetime = 5 function Iamit(part) if not fireinuse then -- Avoid multiple fires to start fireinuse = true fire = Instance.new("Fire") -- Create the fire fire.Parent = part while (part:findFirstChild("Fire") ~= nil) do -- find where the Fire is and take the dmg print(part) Firetime = Firetime - 1 wait(1) print(Firetime) if Firetime <= 0 then part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - 100 -- kill Firetime = 5 break end end fireinuse = false end end firePart = game.Workspace.takepart firePart.Touched:connect(Iamit) function Youareit(part) fire = part:FindFirstChild("Fire") fire:Destroy() if not fireinuse then -- Avoid multiple fires to start fireinuse = true fire = Instance.new("Fire") fire.Parent = part while (part:findFirstChild("Fire") ~= nil) do -- find where the Fire is and take the dmg print(part) Firetime = Firetime - 1 wait(1) print(Firetime) if Firetime <= 0 then part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - 100 -- kill Firetime = 5 break end end fireinuse = false end end local player = game.Players:GetChildren() local character = player.Character.Humanoid if not character or not character.Parent then character = player.CharacterAdded:wait() end character.Touched:connect(Youareit)
You can use the untouched event, and use the argument to create a fire on the users torso. I will write a script when I get home. I'm currently on my phone.