Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

:FireServer sending and receiving different things?

So I have a local script in a tool that says:

if Hit.Name == "this" then
remoteevent:FireServer()
print('sent', Hit)
end

This prints the correct value of what it hits

HOWEVER, in ServerScriptService I have a script that says this:

remoteevent.OnServerEvent:Connect(fucntion(Hit)
print('received')
print(Hit)
end)

This script just print my player. Can anyone explain as to why?

1 answer

✓ Accepted answer

###This is because the first parameter to OnServerEvent is always the player that fired the remote.

remoteevent.OnServerEvent:Connect(function(player, hit)
    print(hit)
end)

------Local code-----
remoteevent:FireServer(hit)
--DO NOT PASS PLAYER, ONLY HIT

This discussion is preserved as it was. New answers, comments, and votes are closed.