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?
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.