So I’m kind of new at scripting (like 5 - 7 months of experience) and I need to use a remote event for a fall damage script. What I’m trying to do is send the amount of damage taken from the client to the server.
Here’s an example:
local script
local damage = math.random(30,60)
remoteevent:FireServer(damage)
I was trying something similar to this but I realized that’s not how remote events work, I have tried to search for help and I can’t figure out how to send a variable value through a remote event from the client to the server, can someone please explain it to me?
What do you mean “sending a variable value?” In my experience thats exactly how you would do it
edit: obviously what @Synteuro said as well
If you are going to do that then check that the damage is a positive value so the client can’t deal negative damage to themselves
It’s possible you were firing the server before the “.OnServerEvent” event listener was properly hooked on the listening side. Take the following for example.
The local script fires the server as soon as it executes but the server script hasn’t hooked the corresponding “.OnServerEvent” event until 10 seconds have elapsed since the script’s execution. This means that the event is never fired.
That’s not it. Server always knows from who is the message. Sending a player would make no sense. It would make sense only in cases when player does an interaction with other player, for example sending a party request or this kind of stuff.