I can only do the mouse hold and mouse release by using mouse.Button1Down and Mouse.Button1Up.
01 | local input = game:GetService( "UserInputService" ) |
02 | local plr = game.Player.LocalPlayer |
03 | input.InputBegin:Connect( function () -- everything u type or click will be recorded |
04 | if input.UserInputType = = Enum.UserInputType.MouseButton 1 and plr.Character ~ = nil then -- if mousebutton1 is clicked aka left mouse button, and checks if plr.Character is a thing |
05 | local anim = instance.new( "animation" ) -- makes animation |
06 | anim.Animationid = "http://www.roblox.com/asset/?id=Animation here" -- specify animation id |
07 | local track = plr.Character.Humanoid:LoadAnimation(anim) -- loads the animation |
08 | track:Play() -- plays animation |
09 | -- ur code here |
10 | end |
11 | end ) |
12 |
13 | input.InputEnded:Connect( function () -- everything u type or click will be recorded this will activate when u release ur key |
14 | if input.UserInputType = = Enum.UserInputType.MouseButton 1 then -- when u released ur click |
15 | -- ur code here |
16 | end |
17 | end ) |
Not sure if this is what u wanted but i hope it helps here is some more info = https://developer.roblox.com/en-us/api-reference/class/UserInputService
Closed as Not Constructive by User#29913, youtubemasterWOW, and Leamir
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?