local UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(i, gameProcessedEvent)
if i.KeyCode == Enum.KeyCode.One then
game.ReplicatedStorage.Test:FireServer()
end
end)
That is the local script^^^ Below is the server script
function ok(plr)
local mouse = plr:GetMouse()
local b = Instance.new("Part")
b.Parent = game.Workspace
b.Position = mouse.Hit.Position
end
game.ReplicatedStorage.Test.OnServerEvent:Connect(ok)
Now this works perfectly fine in studio, but in a real server it says mouse is a nill object. Can someone explain please?

8 comments
The least you can do is write clean code and you couldn't even do that
I made it more simple, can you re read please.
The server can't see client sided non-replicated objects, so you have to send the position on the mouse from the client
Yeah but Im confused on how to do that, do I put it as an argument in the FireServer()?
First make a variable called "player" in the client script. Then make get the mouse with that variable. Make sure that the variable = the player in question.
Ok I did that, then I put it as a argument in FireServer, how do I access it in the serverscript?
Are you trying to find the mouse position?
I got it now I had to look up how to call it from the function