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

why is my animation not playing on published game?, only in roblox studio

Asked by 4 years ago
Edited 4 years ago

I just got script on my sword. sounds and animation is working perfectly or atleast in roblox studio. when I start test, and then use my sword, animation plays normally. but when I publish the game, and then join on roblox. the sword is still damaging and playing sounds, but dont play animations not even the idle one. Script I am using is down below. thanks for advice. Edit:I know what the error is. it says animation failed to load in. Anyone know how to fix it?

local tool = script.Parent

local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack
local swingAnim = script:WaitForChild("Swing")
local swingAnimTrack

local slashSound = script:WaitForChild("SlashSound")
local sheathSound = script:WaitForChild("SheathSound")
local hitSound = script:WaitForChild("HitSound")

local hitCharacters = {}
local debounce = false

tool.Equipped:Connect(function()

    local humanoid = script.Parent.Parent.Humanoid
    if not idleAnimTrack then idleAnimTrack = humanoid:LoadAnimation(idleAnim) end

    idleAnimTrack:Play()

    sheathSound:Play()
end)
tool.Unequipped:Connect(function()

    if idleAnimTrack then idleAnimTrack:Stop() end
    if swingAnimTrack then swingAnimTrack:Stop() end

    sheathSound:Play()
end)
tool.Activated:Connect(function()

    if debounce then return end
    debounce = true

    local humanoid = script.Parent.Parent.Humanoid
    if not swingAnimTrack then swingAnimTrack = humanoid:LoadAnimation(swingAnim) end

    swingAnimTrack:Play()

    wait(0.5)   
    slashSound:Play()

    wait(0.5)
    debounce = false
end)
tool.Blade.Touched:Connect(function(touch)

    if hitCharacters[touch.Parent] or not debounce then return end
    if touch.Parent:FindFirstChild("Humanoid") then

        if touch.Name == "Head" then
            touch.Parent.Humanoid:TakeDamage(10)
        else
            touch.Parent.Humanoid:TakeDamage(5)
        end
        hitSound:Play()
        hitCharacters[touch.Parent] = true
        wait(1)
        hitCharacters[touch.Parent] = nil
    end
end)
0
Is there any errors Pupppy44 671 — 4y
0
how can I see errors when its in published game, not in roblox studio Robert123456789l 2 — 4y
0
You can use F9 (FN + F9 on laptops usually) to open up an admin console in your live games. This can be a useful tool for troubleshooting issues when not in studio. Rocketerkid 237 — 4y
0
it says that animation failed to load in Robert123456789l 2 — 4y
View all comments (3 more)
0
Do you personally own the animation in question? Which animation is it? Which line does it reference? Rocketerkid 237 — 4y
0
I do own the animation and all animations dont work(idle and attack) Robert123456789l 2 — 4y
0
Please do not ask a question more than once. Wait for an answer. I've closed the duplicate question. Link150 1355 — 4y

Answer this question