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

Sending Player:GetMouse() over to server-side not working?

Localscript:

local PlacedObject = PlaceObjectRequest:InvokeServer(Player, Object)

Server Script:

function PlaceObjectRequested(Player, Object)
	Mouse = Player:GetMouse()
	if Mouse.Target == nil then -- [!]
		return
	end

Error: attempt to index global 'Mouse' (a nil value) , where the -- [!] is.

This works without any errors when testing in studio, but as soon as I join a server, it stops working. The error is from the console (F9).

How do I go about fixing this? I have a feeling this may have something to do with the mouse not actually able to be sent to server-side...

Thanks in advance.

1 comment

1

You have a feeling that a mouse cannot go to server side? Well, thats correct! You can only send the mouse's properties, not the mouse itself.

1 answer

✓ Accepted answer

You have to do it like this becuz u cant getmouse in a serverscript

local script

Mouse = Player:GetMouse()
local PlacedObject = PlaceObjectRequest:InvokeServer(Player, Object,Mouse.Target)


server script

function PlaceObjectRequested(Player, Object,Target)
    if Target == nil then
        return
    end

Target is Mouse.Target This is the way you'll want to do it.

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