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.