I would like to resolve this error that keeps popping up randomly. I spent hours trying to resolve and am giving up.
I have a group that I am the owner of, and the game/animations are all published underneath the group. For some reason sometimes the animations work without issue, other times they don’t work at all or produce the error referenced but then still work. This is really frustrating when trying to test things in Studio.
I have tried:
- Republishing the anims under the group multiple times
- Making my own anims and giving permission (apparently I don’t have permission to even my own publishes to give the group the permissions?)
- Forcibly reloading them until it works (but this shouldn’t be necessary, right?)
- Preloading the anims
- I have looked at every forum and cannot find anything that fixes my specific issue
Below is the code where I am attempting to use and load the animations, there is a whole script but there is nothing else that should interact with this behavior other than using the function. As far as I know these are the correct ways? As a last resort, I tried asking ChatGPT and it said this was the best way; I couldn’t find any forums with alternative solutions.
-- Set up animations
local holdAnimation = Instance.new("Animation")
holdAnimation.AnimationId = "rbxassetid://88356619656161"
local castAnimation = Instance.new("Animation")
castAnimation.AnimationId = "rbxassetid://126214103087306"
-- Function to toggle animations
local function toggleAnimation(animationType, play)
local animationTrack
if animationType == "hold" then
animationTrack = holdAnimationTrack or animator:LoadAnimation(holdAnimation)
holdAnimationTrack = animationTrack
elseif animationType == "cast" then
animationTrack = castAnimationTrack or animator:LoadAnimation(castAnimation)
castAnimationTrack = animationTrack
else
warn("Invalid animation type: " .. tostring(animationType))
return
end
if play then
animationTrack.Priority = Enum.AnimationPriority.Action
animationTrack:Play()
print("Playing animation: " .. animationType)
else
animationTrack:Stop()
print("Stopping animation: " .. animationType)
end
end
Any thoughts would be great!