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

Binded animation button does not work, is there an issue in the code?

Asked by
TwetOn 0
2 years ago
Edited 2 years ago

Thats the code:

local player = game.Players.LocalPlayer
local character = player.Character
local human = character.Humanoid

local userInput = game:GetService("UserInputService")
local AnimationId = 'rbxassetid://7588644603'

local key = 'F'
local debounce = true

userInput.InputBegan:Connect(function(Input, IsTyping)
    if IsTyping then return end
    if Input.KeyCode == Enum.KeyCode[key] and debounce == true then
        debounce = false
        local Animation = Instance.new("Animation")
        Animation.AnimationId = AnimationId
        local fullPickUpAnimation = human:LoadAnimation(pickUpAnimation)
        fullPickUpAnimation:Play()
        wait(1.2)
        Animation:Destroy()
        debounce = true
    end
end)

idk i see no problem with that, could anyone explain why it doesnt work please

0
Where did you set the "pickUpAnimation"? You set it as "Animation" and put the AnimationID inside it so thats the animation you want to load, so itd supposed to be "human:LoadAnimation(Animation)". RoiGipot 1 — 2y
0
Thanks a lot, that fixed a part of the issue. The reason it actually didnt work as intended was that i accidentally put this script in StarterPlayerScripts instead of StarterCharacterScripts TwetOn 0 — 2y

Answer this question