Remote Event not bringing the right information

Hello, I have been trying to make a code where you could bring the information about the humanoid into a server script by using remote events. But whenever I do this, the information I want to bring to the server script(the Humanoid), turns into a different information(the Character) is there some way I can fix this? Some parts of the code will be attached.

The server script:

The local script:
Screen Shot 2021-09-19 at 11.16.40 AM

The output for both of the print commands:

The reason for this is that the first parameter for OnServerEvent is always the player who fired the humanoid event.

If you do this:

Event.OnServerEvent:Connect(function(player,x)
        print(x)
end)

It should print out “Humanoid”. You can also print out the player to see which player fired the remote event.

2 Likes

It seems to be working now, thanks!

In your local script the if statement will not run every time the player’s health changes. In your case your checking if the event “HealthChanged” exists, and not if the players health changes. Maybe it’s intentional, but if you want that to fire every time health Changes change it to:

hum.HealthChanged:Connect(function()
       -- Fire Event
end)
1 Like

Oh, I didn’t even notice that. Thanks!