I'm making a remoteevent with this script and idk why it doesn't works, please help me
--This is a Script local Event = game.ReplicatedStorage:WaitForChild("RedWin") local Humanoid = script.Parent:WaitForChild("Humanoid") Humanoid.Died:Connect(function() print("hi") Event:FireServer() end)
Try something like this, except in a LOCAL script, inside StarterPlayerScripts
local plr = game.Players.LocalPlayer local rs = game:GetService("ReplicatedStorage") local event = rs:WaitForChild("RedWin") if plr.Character.Humanoid.Health == 0 then -- what to do if the health is 0 print("hi") event:FireServer(plr) -- you will want to do this to let the server know which player died. end
thanks for the help but i need this script for an npc , not a player