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

humanoid.Died:Connect(function() doesnt seem to be working... any help?

Asked by 2 years ago
Edited 2 years ago

Doesnt seem to be firing Killed, or printing Killed

local REMOTES       = ReplicatedStorage:WaitForChild("Remotes")
local Players           = game:GetService("Players")
local player            = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character         = player.Character or player.CharacterAdded:Wait()
local humanoid      = character:WaitForChild("Humanoid")

player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
    humanoid.Died:Connect(function(player)
        REMOTES.Killed:FireClient()
        print("Killed")
    end)
end)
0
I think the script is getting stuck at your player variable. You do not need to use the PlayerAdded method since a local script won't even run before the player has been added. AZDev 590 — 2y
0
Is this a localscript or regular script iamajunky 20 — 2y
0
I dont see so much of a problem but maybe an easier way to do it is by saying the players health = 0 coolants19 1 — 2y
0
the classic "I don't see a problem" by skids when there are 6 problems present. greatneil80 2647 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

I had a problem like this before, the way I solved it is by using remote events.

Ad

Answer this question