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

How can I make this code repeat every time a player dies?

Asked by 5 months ago

I've tried this but it didn't work.

while wait(1) do
    local player = game:GetService("Players").LocalPlayer
    local humanoid  = player.Character.Humanoid

    if humanoid.Health == 0 then
        wait(6)
        mouse.KeyDown:Connect(function(key)
            if key == "e" then
                if mouse.Target then
                    humanoidRoot.CFrame = CFrame.new(mouse.Hit.x,mouse.Hit.y + 5,mouse.Hit.z)
                end
            end
        end)
    end
end
1
humanoid.Died:Connect(function() greatneil80 2311 — 5mo
0
That didn't work osamayousef123 14 — 5mo
0
if Died doesn't work, myb HealthChanged SerpentineKing 3850 — 5mo
0
Doesn't that work all the time even if the player dies and even without the humanoid.Health ==0? roussimoff 17 — 5mo

1 answer

Log in to vote
0
Answered by 5 months ago

I would reckon highering the spawn location and putting a block on the spawn location, and the putting:

script.Parent.Touched:Connect(function(hit)
-- code here
end)
0
I will try that osamayousef123 14 — 5mo
Ad

Answer this question