#Can you set the animation to start after the proximity prompt ends?

1 messages · Page 1 of 1 (latest)

acoustic edge
#
local Animation = script.Animation

local function PlayAnim(Player: Player)
    local Character = Player.Character
    local Animator = Character:WaitForChild("Humanoid"):WaitForChild("Animator") :: Animator

    local AnimTrack = Animator:LoadAnimation(Animation)
    AnimTrack.Priority = Enum.AnimationPriority.Action
    AnimTrack.Looped = true
    AnimTrack:Play()
end

local function EndAnim(Player: Player)
    local Character = Player.Character
    local Animator = Character.Humanoid:WaitForChild("Animator") :: Animator

    local PlayingTracks = Animator:GetPlayingAnimationTracks() :: {AnimationTrack}
    for _, AnimTrack in PlayingTracks do
        if (AnimTrack.Animation == Animation) then
            AnimTrack.Looped = false
            AnimTrack:Stop()
        end
    end
end

ProximityPrompt.PromptButtonHoldBegan:Connect(PlayAnim)

ProximityPrompt.Triggered:Connect(EndAnim)
ProximityPrompt.PromptButtonHoldEnded:Connect(EndAnim)```
#

(Try to paste scripts like this)

acoustic edge
#

No, it was just a tip for you

#

For people to better undeserstand