so this is from the receiving side in a script in starter character scripts:
game.ReplicatedStorage.jump.OnServerEvent:Connect(function(me, mouse) mouse.KeyUp:Connect(function(key) if key == "Space" then holding = false end end) end)
and this is the sending side in a local script also in starter character scripts:
local mouse = game.Players.LocalPlayer:GetMouse() game.ReplicatedStorage.jump:FireServer(mouse)
and there is a remote event named jump in replecated storage when i print mouse on local script it says instance (good) but when i print mouse in script it says nil (bad) why is this happening?
The API for GetMouse()
states: "This item must be used in a LocalScript to work as expected online."
I think you would be better off using UserInputService on the client (LocalScript) to get the player's input, and then fire the remote event. Something like this:
local UserInputService = game:GetService("UserInputService") local remoteEvent = game:GetService("ReplicatedStorage").jump UserInputService.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.Space then jump:FireServer() end end)
I recommend you read the documentation on UserInputService
if you don't fully understand.
Hope this helped, good luck!