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

How to LeftClick To Punch?

Asked by 5 years ago
Edited 5 years ago

What Keycode For Left Click here script for punch :

01local player = game.Players.LocalPlayer
02local db = true
03local damage = false
04 
05local anim = Instance.new("Animation")
07 
08game.Players.LocalPlayer.Character:WaitForChild("RightHand").Touched:Connect(function(hit)
09    if hit.Parent:FindFirstChild("Humanoid") and not db and not damage and hit.Parent.Humanoid ~= game.Players.LocalPlayer.Character.Humanoid then
10        if game.Players.LocalPlayer.Character.Humanoid.Health > 0 then
11            damage = true
12            game.ReplicatedStorage.Punch:FireServer(hit.Parent.Humanoid)
13        end
14    end
15end)
View all 26 lines...
0
can you please use the code block on the website. it makes things easier for everybody mm1678YT 80 — 5y
0
edited OrewaKamidaa 40 — 5y
0
MouseButton1 DeceptiveCaster 3761 — 5y
0
But it isn't a KeyCode because mouse buttons aren't keys. Mouse buttons are input types. DeceptiveCaster 3761 — 5y
0
oh OrewaKamidaa 40 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

It's not a keycode you're looking for (because the mouse doesn't have keys), but a UserInputType: if input.UserInputType == Enum.UserInputType.MouseButton1

0
Thanks You ^^ OrewaKamidaa 40 — 5y
Ad

Answer this question