Hi, so I have a normal script inside of an NPC/rig and I want that script to fire a remote event So that my quest GUIs value on the screen will change to 1 and I really need help with this.When ever I try and fire a remote event it says that I need a player function when I have the function connected to the player funtion.Yet any other script works like if I want to print Hi.
local Humanoid = script.Parent.Humanoid local event = game.ReplicatedStorage:WaitForChild("Human1") Humanoid.Died:Connect(function(player) event:FireClient(player) end)
Human one is The name for my remote event
You could try to check the Humanoids health instead of the function. Such as:
local hum = --your humanoid if hum.Health == 0 then --checks if the Humanoid's health is 0 event:FireClient(player) end)
I hope this helped c:
Humanoid.Died does not pass the Player
Store a script inside a humanoid. I'm assuming that you want to do something on the server's side so instead of using a remote event to fire a client, use a Bindable Event. Bindable Events are basically remote events, but for two servers talking to each other. You will also need to use a .Changed event too. If you want to use a remote event, then do the same thing in this script, but with a remote event. TIP: You can use a BindableEvent in the same script.
script.Parent.Humanoid:GetPropertyChangedSignal("Health"):Connect(function() BindableEvent:Fire() end) BindableEvent.Event:Connect(function() -- Event end)