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

When the F button is pressed, replace the Idle animation with another?

Asked by 4 years ago
Edited 4 years ago
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
                player.PlayerScripts.QQ.Disabled = false
                wait(1)
                enabled = true
                end
            end
        end
end
end)

Answer this question