Sadly yields another error.
Ok… this looks like an issue where the humanoid hasn’t loaded, one second.
What you could do is use the Humanoid.Health = 0, because when health is 0 you are dead.
this is a local script correct?
if so you can just run the consequence in it, i looked up and you can add a timeout waitforchild
Players.Character:WaitForChildren(“Humanoid”,10).Died:Connect(function(plr)
I thought it was meant to be a Server Script…?
It fires an event which connects to a local script within the GUI which then changes a value.
Oh wait it is a server script, alright we need to add something to classify if the character is loaded or not.
So use one of these before it runs that function.
p.CharacterAdded:connect(function(s)
end)
or change to character to
local character= Players.CharacterAdded:wait()
??
local Players = game.Players:GetPlayers()
local Character= Players.CharacterAdded:wait()
Players.Character:FindFirstChild("Humanoid").Died:Connect(function(plr)
???
Do this
Look in output for player died.
local death = game.localplayer.Humanoid.Health = 0
game.localplayer.Character:WaitForChild("Humanoid")
function HumanoidDeath()
Print("Player Died!")
end
Game.localplayer.Character.Death:Connect(HumanoidDeath)
If you’re doing Server to Client, use FireClient(player, args)
Ran into an error when I used the code
local Players = game.Players:GetPlayers()
local Character= Players.CharacterAdded:wait()
Players.Character:FindFirstChild("Humanoid").Died:Connect(function(plr)
(this line exactly)
characteradded is a function like .Died i believe
Wait(Nil value) There is nothing in the wait built in function. Of course it will be nill.
What is the game waiting for?
Try the other option then i assume
p.CharacterAdded:connect(function(s)
end)
What is “p”? Player? There’s also function(s) - I have no idea what “s” is
Oh right typo, suppose to be Players, no s aswell
Where was this meant to be implemented?
always check the wiki to see how to actually know how to use new things and how stuff works
local Players = game.Players:GetPlayers()
Players.CharacterAdded:Connect(function(s)
local character = s
character.Humanoid.Died:Connect(function(plr)
for _, v in pairs(Players) do
if v:DistanceFromCharacter(plr.Parent.HumanoidRootPart.Position) <= 10 and v.Team == game.Players[plr.Name].Team then
--fire consequences
print ("eeeee")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Death")
-- Fire the remote event
remoteEvent:FireServer()
end
end
end)
end)
Can I get an explanation? (30 characters)
So basically I added CharacterAdded to check if the character exists in this new one, so i can remove the wait for humanoid which didnt work