Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a script using the mousebutton1click function?

I'm currently trying to make a fighting game where when you left click you can play a punching animation. I cant figure out how to make this, so can someone help me?

1 comment

0

I've already made the punching animation.

1 answer

--local script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local animation = 0 --ANIMATION ID HERE

mouse.Button1Down:Connect(function()
	animTrack = player.Character.Humanoid:LoadAnimation(animation) -- Load animation into Humanoid
	animTrack:Play()
end)

3 comments

0

@gingeylol It keeps saying humanoid isnt a valid member of player

0

oops

0

player.Character.Humanoid:LoadAnimation(animation)

This discussion is preserved as it was. New answers, comments, and votes are closed.