Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to solve a conflict betwen a spawn script and a kill script?

Asked by 13 days ago

I have 2 scripts in my game, one that makes the player respawn faster:

local respawnDelay = 1
 game.Players.CharacterAutoLoads = false

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local humanoid = character:FindFirstChild("Humanoid")
        if humanoid then
            humanoid.Died:connect(function()
                wait(respawnDelay)
                player:LoadCharacter()
            end)
        end
    end)
    player:LoadCharacter()
end)

and other that make it so water acts like lava:

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Character)
        wait(1/60)
        Character.Humanoid.Swimming:connect(function()
            Character.Head.Splash.Volume = 0
            Character.Head.Swimming.Volume = 0
            Character.Humanoid.Health = 0
            local C = Player.Character:GetChildren()
            for i = 1, #C do
                if (C[i].className=="Part" or C[i].className=="MeshPart") and C[i].Name ~= "HumanoidRootPart" then
                    if C[i].Name == "Head" and Character.Humanoid.RigType == "R6" then
                        C[i].Size = Vector3.new(1,1,1)
                    end
                    if C[i]:FindFirstChild("Flames") == nil then
                        local Flames = script.Flames:Clone()
                        Flames.Parent = C[i]
                        Flames.Rate = Flames.Rate*C[i]:GetMass()
                        Flames.Enabled = true
                    end
                    if C[i]:FindFirstChild("Sparks") == nil then
                        local Sparks = script.Sparks:Clone()
                        Sparks.Parent = C[i]
                        Sparks.Rate = Sparks.Rate*C[i]:GetMass()
                        Sparks.Enabled = true
                    end
                end
            end
        end)
    end)
end)

somehow, the first script makes it so this one doesn't kill the player, any way to solve this?

Answer this question