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

Animation appears to play without stopping?

Asked by 2 years ago
Edited 2 years ago

So, i tried playing an animation when a tool is activated, but when the other player activates the tool, the animation appears to me as it is playing non-stop. Also, the other player is not able to see when i play the animation.

The following LocalScript is parented to the tool.

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local anim = humanoid.Animator:LoadAnimation(script.Parent.PunchAn)
local cooldown = false
anim.Looped = false
-------------------------------------------------------------
script.Parent.Activated:Connect(function()
    if cooldown == false then
        anim:Play()
        anim:AdjustSpeed(2.2)
        cooldown = true
        if cooldown == true then
            wait(0.9)
            cooldown = false
        end
    end
end)
1
anim.Looped = false RainDroutz 23 — 2y
0
Try replacing line 4 with "local anim = humanoid:LoadAnimation(script.Parent.PunchAn)" SnowieDev 171 — 2y

Answer this question