Roblox converting b to 735 when firing in a rm

when i fire this rm in this function
local script




script.Parent.sell.MouseButton1Down:Connect(function(plr)
    local plrsell = script.Parent.input.Text
    game.ReplicatedStorage.clearauction:FireServer(plr, plrsell)
    print(plrsell)
end)

and print plrsell when the rm is fired in the server

    
        game.ReplicatedStorage.clearauction.OnServerEvent:Connect(function(plr, plrsell)
            print(plrsell)
        end)
        

it returns a number for example if i fire b as plrsell it returns 735 as plrsell when i print it on the server. it also does this with other characters be is just an example.

I see 2 problems

  • Problem 1: When you fire the RemoteEvent, Roblox automatically adds an argument that tells the server who fired it. For example, if you fire a RemoteEvent with ("hi"), the server will get (PlayerWhoFired, "hi").

  • Problem 2: When the MouseButton1Down event fires, it returns the X and Y coordinates of the mouse, not the player who clicked. The 735 is the X coordinate of your mouse.

  • Solution: Since solution 1 already told the server who fired the RemoteEvent, the plr variable isn’t needed.

Local Script:

script.Parent.sell.MouseButton1Down:Connect(function()
    local plrsell = script.Parent.input.Text
    game.ReplicatedStorage.clearauction:FireServer(plrsell)
    print(plrsell)
end)

Server script:

game.ReplicatedStorage.clearauction.OnServerEvent:Connect(function(plr, plrsell)
    print(plrsell)
end)
2 Likes