RemoteEvent argument transfer issue

Hello! So to start I have a code in a local script and a script in ServerScriptService.
The local script is supposed to transfer the given data “player, Blocking” through the RemoteEvent using game.ReplicatedStorage.BlockingChanged:FireServer(player, Blocking). Though this is having some issues as when the server side picks it up it receives the data as the player, “player, player” is the output of my print so it is receiving the argument as “player, player” when it was sent as “player, Blocking.” This is the local script:

local player = game.Players.LocalPlayer
local Blocking = false

script.Parent.MouseButton1Click:Connect(function()
if Blocking == false then
Blocking = true
print(Blocking)
game.ReplicatedStorage.BlockingChanged:FireServer(player, Blocking)
else
Blocking = false
print(Blocking)
game.ReplicatedStorage.BlockingChanged:FireServer(player, Blocking)
end
end)

and this is the server script:

game.ReplicatedStorage.BlockingChanged.OnServerEvent:Connect(function(player, Blocking)
print(player, Blocking)
end)

Sorry for my bad formatting…

1 Like

When Firing A remote event from the client, it automatically sends the player to the server as the first parameter. You should just use :FireServer(Blocking). On the server-side, the parameters on the server side will not need to be changed.

You can find out more here: RemoteEvent | Documentation - Roblox Creator Hub

2 Likes

You do not need to pass the player instance as an argument as OnServerEvent()'s first parameter will be the player instance that triggered the FireServer() event.

2 Likes

Thanks for trying but my issue was to get Blockings Bool value through a print command, it will still print Blocking as SloppyBanana225…

Oh whoops sorry guys I forgot to remove plr from the local script. My bad…