Hello, I have an animation that i play when pressing Q, it does the animation and I want the animation to stop when its at the end of the animation and when the player lifts there finger off Q then the animation resets. What would be the best possible fix?
local UIS = game:GetService("UserInputService")
local animation = game.Workspace.Animations.LeanLeft
local humanoid = game.Players.LocalPlayer.Character.Humanoid
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
local animationTrack = humanoid:LoadAnimation(animation)
wait()
animationTrack:Play()
end
end)
local UIS = game:GetService("UserInputService")
local animation = game.Workspace.Animations.LeanLeft
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local animationTrack = humanoid:LoadAnimation(animation)
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
animationTrack:Play()
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
animationTrack:Stop()
end
end)
Wouldn’t something like this work ?
PS : If you want to freeze the animation you can adjust the speed to 0 of the animation track
CAN be… because either way in a Local Script or not exploiters can change the ID’s of said animation. IF the Script / Animation is within reach of said exploiter.
Yes. When creating the Animation you have a few options to select what type it’ll be.
Type meaning whether a specific animation can stop yours and play instead or interfering with the Standard animations to move.
The one you most likely want is Action or Movement.
Also side note: Don’t loop the animation within the Animations itself.
In the script when loading you can do: