In a local script, a remote is fired ONCE and a print statement is also fired ONCE, however on a server script, when the remote is recieved the code runs multiple times
also, every time the remote is recieved the code gets ran more and more, so if the remote is recieved 3 times the code will run like 20 times but if its recieved 10 times it will run like 90 times when it should always run once
example
LOCAL SCRIPT
local coolremote = script.Parent.RemoteEvent
PlayerGetsHitFunction:Connect(function(hit, hum, stuff)
coolremote:FireServer()
print("Client Detects Hit") --PRINTS ONCE
end)
SERVER SCRIPT
local coolremote = script.Parent.RemoteEvent
coolremote.OnServerEvent:Connect(function(hit, hum, stuff)
print("Recieved!") --Every time this remote is recieved, this prints more and more
end)
Sending (hit, hum, stuff) will be received as (player, hit, hum, stuff).
RemoteEvents pass the Player Instance as the first variable to a OnServerEvent event. You should change it to this instead:
-- LOCAL SCRIPT
local remote = script.Parent.RemoteEvent
local function PlayerGetsHitFunction(hit, hum, stuff)
remote:FireServer(hit, hum, stuff)
print("Client Detects Hit")
end
-- SERVER SCRIPT
local remote = script.Parent.RemoteEvent
remote.OnServerEvent:Connect(function(player, hit, hum, stuff)
print("Recieved!")
end)