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

[ANSWERED] Why does my friend's animation not work - I have action enabled?

Asked by
KingDomas 153
3 years ago
Edited 3 years ago

All in all, my friend has made at least 5 animations for a tool, and when you click it makes you play the animation. He set the animation to action, and the script runs my animation perfectly. But when we change the AnimationId to his animation, it doesn't work. Does anyone have any idea why this doesn't work? My script:

AnimationId: rbxassetid://5357281801

local spells = {
    "lumos",
    "nox"           
}

local activeSpell
local tool = script.Parent

repeat wait() until game.Players:GetPlayerFromCharacter(tool.Parent)
local plr = game.Players:GetPlayerFromCharacter(tool.Parent)
local db = false
local cooldown = 3

--possible future stats     local mpc = plr.leaderstats.MPC.Value

tool.Activated:Connect(function()
    if not db then
        db = true
        local anim = game.ReplicatedStorage:FindFirstChild("CastWand")
        local animtrack = plr.Character.Humanoid:LoadAnimation(anim)
        animtrack:Play()
        if activeSpell ~= nil then
            print("Working!")
        end
        wait(cooldown)
        db = false 
    end
end)

game.PlayerAdded:Connect(function(player)
    game.Players.LocalPlayer.Chatted:Connect(function(msg)
        local spell = string.lower(msg)
        if spell == #spells then
            activeSpell = spell
        end
    end)
end)
-- if any future stats
--[[ tool.Activated:Connect(function()
    if mpc == 0 then
        mpc = mpc + 1
    end
    if estore == 0 then
        estore = estore + 20
    end
    if cooldown == 0 then
        cooldown = cooldown + 1
    end
end) ]]
0
Animations in studio can only be seen by the owner of the animation, and ingame it only plays if the animation is owned by the game owner, I'm guessing that's your issue Glacitron 239 — 3y
0
Answered by this kind man. ^ KingDomas 153 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Hmm,

I haved problem before but I fixed that with Stopped all tracks in character and then playing animation or it can be issue as said Glacitron

for _,s in pairs(Character.Humanoid:GetPlayingAnimationTracks()) do
s:Stop()
end

local load = Character.Humanoid:LoadAnimation(animation)
load:Play()

Ad

Answer this question