Animation runs on studio but not in-game

I made a script for when you ride your bike it’ll make the character play an animation. In studio it plays both animations but on the Roblox Player or when you are playing the game out of studio it’ll only run “AnimationTrack2” and doesn’t run “AnimationTrack”

Here’s the script:

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
	character = player.CharacterAdded:Wait()
end
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://"

local Animation2 = Instance.new("Animation")
Animation2.AnimationId = "rbxassetid://"

--Took the ID out

local AnimationTrack = animator:LoadAnimation(Animation)
local AnimationTrack2 = animator:LoadAnimation(Animation2)

AnimationTrack.Priority = Enum.AnimationPriority.Action

AnimationTrack.Looped = false

AnimationTrack2.Priority = Enum.AnimationPriority.Action

AnimationTrack2.Looped = false

local DB = false

game.ReplicatedStorage.BikeAni.OnClientEvent:Connect(function(thr, occ, stop)
	AnimationTrack2.Priority = Enum.AnimationPriority.Action
	AnimationTrack.Priority = Enum.AnimationPriority.Action
	if thr > 0 and DB == false or thr < 0 and DB == false and stop == "Nil" then
		DB = true
		AnimationTrack2:Play()
		wait(1)
		AnimationTrack2:Stop()
		DB = false
	elseif thr == 0 and occ ~= nil and DB == false and stop == "Nil" then
		DB = true
		AnimationTrack:Play()
		wait(1)
		DB = false
	elseif stop == "Stop" then
		AnimationTrack:Stop()
		AnimationTrack2:Stop()
		wait(1)
		AnimationTrack:Stop()
		AnimationTrack2:Stop()
	end
end)

Like I said earlier I know that the event fires and it stops the animation when you jump off and inside studio when the thr = 0 it will play but not when you are in-game.

1 Like

Is the game created by a group? If so, is the animation exported by the group?

An animation created by a person in a game created by a group will cause the animation to not run in game yet appear working in studio.

And while I’m here are there any errors in the output? Sorry if I missed something.

4 Likes

There are no errors in the output. The animation is under my account but my own the group.

2 Likes

The group has to upload the animation

2 Likes