Then I have another sword script using joint (Not Tool). So when I press "F", I stop the animation to change to another and remain active until I press "F" again to disable, I can make it play once and only.
local enabled = true
local player = game.Players.LocalPlayer
local Service = game:GetService("UserInputService")
local Character = player.Character or player.CharacterAdded:Wait()
Service.InputBegan:connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.F then
if enabled == true then
wait(.5)
enabled = false
player.PlayerScripts.QQ.Disabled = true
local animation = Instance.new("Animation")
animation.Parent = player.Character.Humanoid
animation.AnimationId = "http://www.roblox.com/Asset?ID=03789053986"
local animTrack = player.Character.Humanoid:LoadAnimation(animation)
animTrack:Play()
elseif enabled == false then
animTrack:Stop()
player.PlayerScripts.QQ.Disabled = false
wait(1)
enabled = true
end
end
end
end
end)

1 comment
This may help you https://developer.roblox.com/en-us/api-reference/property/AnimationTrack/Looped