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 6 years ago

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

01local mouse = game.Players.LocalPlayer:GetMouse()
02local on = true
03local size = .1
04local ammo = 6
05script.Parent.Activated:Connect(function()
06 
07script.Parent.make:FireServer()
08 
09 
10 
11 
12end)   
13script.Parent.Deactivated:Connect(function()
14 
15    script.Parent.fire:FireServer()
16 
17    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 — 6y

1 answer

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

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

Local:

01local mouse = game.Players.LocalPlayer:GetMouse()
02local on = true
03local size = .1
04local ammo = 6
05script.Parent.Activated:Connect(function()
06 
07script.Parent.make:FireServer(mouse.Target) -- or any other mouse property you'd like to use such as hit, etc.
08 
09 
10 
11 
12end)   
13script.Parent.Deactivated:Connect(function()
14 
15    script.Parent.fire:FireServer()
16 
17    end)

Server:

1eventname.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.]]--
2 
3--your code here <3
4end)
0
LOL thx soo i feel like an IDIOT helleric -3 — 6y
0
Well, we all have our "dumb" times haha, success brother. piRadians 297 — 6y
Ad

Answer this question