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

My animation is failing to load in Roblox Player?

Asked by 5 years ago
Edited 5 years ago

My Animation script plays a simple Throw Animation:

         wait()
    local CanEmote = true
        local Player = game.Players.LocalPlayer
    local character = Player.Character or Player.CharacterAdded:Wait()
    local Humanoid = character.Humanoid
    local Animation = Humanoid:LoadAnimation(script.Throw)

    script.Parent.MouseButton1Click:Connect(function()
      if CanEmote then
        Animation:Play()
        CanEmote = false
        wait(1)
        CanEmote = true

      else print("An Error Occured")
      end
    end)

In studio, the output is the animation plays. But In the actual Roblox game, It doesn't load. I go to the Developer Console. I get an error saying my animation failed to load. I try this code:

local ContentProvider = game:GetService("ContentProvider")

local ThrowId = "rbxassetid://2192870054"

local Animation = Instance.new("Animation")
 Animation.AnimationId = ThrowId

local assets = {Animation} 
ContentProvider:PreloadAsync(assets)
 print("All Assets Loaded")

It doesn't work. I don't know why, but it won't load. I have this code in a LocalScript, and it even works in studio. Can someone tell me why it isn't loading and what I have to do to fix this please?

--Is there some way I can store the animation so the game has it in it's cache?

0
Please tell me what I am doing wrong or what code I have to write to fix this? Is my game memory to full? Is there too much lag? RetroGalacticGamer 331 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

If you want to store the animation somewhere, you can store it in the workspace or ReplicatedStorage, and then have a variable cloning it and adjusting that clone's parent to where you need it. A problem could be in your MouseButton1Click function with your debounce turning on and off. First, try to fix your errors in the F5 Dev Console if there are any, secondly if that doesn't work try testing it without your debounce and see if it works in game.

0
I will try it RetroGalacticGamer 331 — 5y
0
sorry man didn't work for me, but for now on I am going to clone the animation like you said RetroGalacticGamer 331 — 5y
0
Can you post the error from the Dev Console from ingame and not studio? Is the animation yours or by Roblox? Because if you don't own an animation and try to use it, it doesn't work ScrubSadmir 200 — 5y
0
It is my animation but I figured out what I did wrong... It turns out that my game was a group game and it was my animation, not the group's so it failed to load. now it is working but thanks RetroGalacticGamer 331 — 5y
0
but I will give you this one because storing it in replicated storage is a really good idea and I already solved it so RetroGalacticGamer 331 — 5y
Ad

Answer this question