Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago

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)

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 mudathir2007 157 — 5y

1 answer

Log in to vote
3
Answered by
piRadians 297 Moderation Voter
5 years ago

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)

0
LOL thx soo i feel like an IDIOT helleric -3 — 5y
0
Well, we all have our "dumb" times haha, success brother. piRadians 297 — 5y
Ad

Answer this question