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

Passing GetMouse() between scripts?

Suppose that i want to get LocalPlayer's Mouse, and pass it to the server how would i do it? Also, if I want to do it with filtering enabled, how would i do it?

1 answer

✓ Accepted answer

You unfortunaly can't do this.

it looks like you can do the following, but that only works in studio. If you want to use anything of the mouse inside of the server, you should send all the things you want to send to the server seperatly. (Event:FireServer(mouse.Target,mouse.hit.p) etc.)

----{WARNING}This code only works in studio because everything counts as local.{WARNING}-----

--localscript

local mouse = game.Players.LocalPlayer:GetMouse()

onDesiredEventTrigger:Connect(function()
	game.ReplicatedStorage.Event:FireServer(mouse)
end)




--server

game.ReplicatedStorage.Event.OnServerEvent:Connect(function(player,mouse)
	--do stuff with mouse
end)

1 comment

0

Thanks for Replying. I after all managed to get it working later after going through docs. Again Thanks

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