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

how do i GET MOUSE from a local script if i am using a remote event ?

how do i GET MOUSE from a local script if i am using a remote event i been trying

local mouse = game.Players.LocalPlayer:GetMouse()
local on = true
local size = .1
local ammo = 6
script.Parent.Activated:Connect(function()
	
script.Parent.make:FireServer()
	
	
	
	
end)	
script.Parent.Deactivated:Connect(function()

	script.Parent.fire:FireServer()

	end)

1 comment

0

Why would you try to use a player's mouse on the server? Just do that on a localscript and then what happens in the serverscript

1 answer

✓ Accepted answer

Hi. I wouldn't fire the mouse itself, I would fire a mouse Property, example: "mouse.hit"

Local:

local mouse = game.Players.LocalPlayer:GetMouse()
local on = true
local size = .1
local ammo = 6
script.Parent.Activated:Connect(function()

script.Parent.make:FireServer(mouse.Target) -- or any other mouse property you'd like to use such as hit, etc.




end)    
script.Parent.Deactivated:Connect(function()

    script.Parent.fire:FireServer()

    end)


Server:

eventname.OnServerEvent:Connect(function(plr, mousetarget)  --[[ remoteevents pass the player as the first parameter, and the second, and third, and in that order, respectively to the ones you defined on the localscript.]]--

--your code here <3
end)

2 comments

0

LOL thx soo i feel like an IDIOT

0

Well, we all have our "dumb" times haha, success brother.

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