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

MouseButton2 Click how to do it? help pls ( Advance )

Asked by
14dark14 167
5 years ago

When you hold right mouse button you scope in with a gun I only know how to do that with a key, but how to do it with mouse?

01Player = game.Players.LocalPlayer
02mouse = Player:GetMouse()
03 
04if mouse then
05mouse.KeyDown:connect(function(key)
06if key== "c" then  
07 
08    print("Test")
09 
10      end
11    end)
12end
0
this is a pretty basic topic considering I understand how to do it, maybe you should research a little instead of just asking the answer is everywhere Feroxidus 83 — 5y
0
Fero can u help me i have been researching for a day and cant get my turret to work. I made it shoot, but the bullet just flopps down i added a body thrust but if i make target offset not make it flop it will curve and go somewhere i dont want it to go Nervousmrmonkey2 118 — 5y
0
I'd love to help if I could, but I'm only a beginner I started when we were put under quarantine, I don't have the slightest understanding of ray casting, and am learning about that now, I'd go to the roblox devforum and post your question there Feroxidus 83 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Here see if this works

1UserInputService.InputBegan:Connect(function(Input)
2    if Input.UserInputType == Enum.UserInputType.MouseButton1 then
3        -- mouse
4    elseif Input.UserInputType == Enum.KeyCode.ButtonR2 then
5        -- R2
6    end
7end)
Ad

Answer this question