GMAL222
(Excortia)
September 3, 2023, 12:39pm
#1
I am trying to create death scene, but its not detecting when player dies. can anyone tell me why?
local player = game.Playes.LocalPlayer;
local Character = player.Character
local Humanoid
if Character then
Humanoid = Character:FindFirstChild("Humanoid")
end
respawn = 1;
print(Humanoid);
Humanoid.Died:Connect(function()
script.Parent.Frame.Visible = true;
while respawn < 10 do
wait(1);
respawn += 1;
end
script.Parent.Frame.Visible = false;
end)
1 Like
Did you disable ResetOnRespawn ?
1 Like
Hey man. Maybe change this line from this:
local Character = player.Character
local Humanoid
if Character then
Humanoid = Character:FindFirstChild("Humanoid")
end
To this?
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
Also, is your script a LocalScript?
1 Like
GMAL222
(Excortia)
September 3, 2023, 12:50pm
#4
Yes its is localscript! will it cause problems?
18ras
(18ras)
September 3, 2023, 12:51pm
#5
hey man, your line 1 is game.PLAYES not PLAYERS you’re missing an r
No it will not cause any problems.
Have you tried the solution I came up wi the up above?
Also maybe try putting the LocalScript inside of StarterPlayerScripts.
GMAL222
(Excortia)
September 3, 2023, 12:52pm
#7
18ras:
PLAYES not PLAYERS you’r
Still doesnt work. any more ideas???
18ras
(18ras)
September 3, 2023, 12:52pm
#8
does anything print out at all from the prints you have?
18ras
(18ras)
September 3, 2023, 12:58pm
#9
@GMAL222
Hello, this script works and detects when the player dies:
local char = game.Players.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid")
print(char, hum)
hum.Died:Connect(function()
end)
1 Like
system
(system)
Closed
September 17, 2023, 12:58pm
#10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.