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
4 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?

Player = game.Players.LocalPlayer
mouse = Player:GetMouse()

if mouse then
mouse.KeyDown:connect(function(key)
if key== "c" then   

    print("Test")

      end
    end)
end

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 — 4y
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 — 4y
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 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Here see if this works

UserInputService.InputBegan:Connect(function(Input)
    if Input.UserInputType == Enum.UserInputType.MouseButton1 then
        -- mouse
    elseif Input.UserInputType == Enum.KeyCode.ButtonR2 then
        -- R2
    end
end)
Ad

Answer this question