✓ Accepted answer
Well.......
You are using .OnServerEvent in a local script, that's obvious.. You even answerd yourself, and the error shown is very easily comprehinsable. Always check your script carefully!
Now I guess you did this because in your server script youc ant refer to the LocalPlayer.
Now isn't that just perfect! Your :FireServer function which is going to be inside your local script
can also send to the server any given paramater. That's so helpful and the exact solution for your problem. Always use it.
Now let me explain what Is said
-This is your local script
local player = game.Players.LocalPlayer
local number = 72
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote:FireServer(player, number)
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote.OnServerEvent:Connect(function(player, number)
print(player, number)
arguments that i put in the local script! and now you got access to player and 72, i ho^pe
you got the idea, and remember that this event will fire when :FireServer did its thing.
end)
Im glad that i helped, and i hope you understood how remote events work.
More Information!
2 comments
Learn how to read
It is telling you the error, so use common sense (the best solution to all problems, even ones outside of programming) to fix it