I've made an remote event to kill the player once it's fired and it doesn't work. I will provide local script and server script beneath because I am done with this. I will also use --To show where it doesn't work

Server script:

function Critical(player)
  while true do
    wait(0.1)
    if player.Character.LimbStatus.HeadDamaged.Value == 2 or player.Character.LimbStatus.TorsoDamaged.Value == 2 then --Probably has to do something with this
      workspace[player.Name].Humanoid:TakeDamage(100)
    end

  end
end

game.ReplicatedStorage.Events.Death.OnServerEvent:Connect(Critical)

Now the Local script:

wait(3)
local Player = game.Players.LocalPlayer
local Char = Player.Character
local Hum = Char:FindFirstChild("Humanoid")

local LeftLeg = game.Players.LocalPlayer.Character:FindFirstChild("Left Leg").LeftLegLimb
local RightLeg = game.Players.LocalPlayer.Character:FindFirstChild("Right Leg").RightLegLimb
local Head =  game.Players.LocalPlayer.Character:FindFirstChild("Head").HeadLimb
local Torso = game.Players.LocalPlayer.Character:FindFirstChild("Torso").TorsoLimb 

while true do
  wait(0.1)
  if LeftLeg.Value < 1 then
    Hum.WalkSpeed = 8
    Hum.JumpHeight = 1
    print("LeftLeg is critically Damaged")
    Char.LimbStatus.LeftLegDamaged.Value = 2
  end
  if RightLeg.Value < 1 then
    Hum.WalkSpeed = 8
    Hum.JumpHeight = 1
    print("RightLeg is critically Damaged") 
    Char.LimbStatus.RightLegDamaged.Value = 2
  end

  if LeftLeg.Value < 1 and RightLeg.Value < 1 then
    Hum.WalkSpeed = 3   
    Hum.JumpHeight = 0.1
    print("Both Legs are critically Damaged")
  end
  if Head.Value < 1 then
    game.ReplicatedStorage.Events.Death:FireServer() --Here it doesn't fire
    Char.LimbStatus.HeadDamaged.Value = 2
    print("Head critically Damaged, commencing death.")
    break
  end
  if Torso.Value < 1 then
    game.ReplicatedStorage.Events.Death:FireServer() --Here it doesn't fire
    Char.LimbStatus.HeadDamaged.Value = 2
    print("Torso critically Damaged, commencing death.")
    break
  end
end

6 comments

0

are there errors in the output? And how exactly do you know that the event is not firing, did you test it with prints?

0

Is there any errors? Maybe because you have to do WaitForChild on the remoteevent in the server script.

0

There's not any errors in the output. I just changed a bit on the script and now it completely doesn't do anything

0

I fixed it, holy I just changed a bit of the code and now it works perfectly

1

Still thank you guys for the help!

0

@AProgrammR i can tell you something about WaitForChild if you want -> dm in bio