Ad
Log in to vote
0

Why Won't The Bus Animation Play In A LocalScript?

Asked by 19 days ago
Edited 19 days ago

Hello! So today I was making an animation for a bus, and I wanted to put the animation of the bus when a player joins the game, and make the local player the only one that can see the bus animation. I inserted an "AnimationController" in the bus, and then I inserted an Animation object named "BusGoesOff" and an "Animator" inside the AnimationController. This is the script I made:

local Animator = script.Parent:FindFirstChildWhichIsA("Animator") or Instance.new("Animator",script.Parent.AnimationController)

local Animations = {}

do
    local BusGoesOff = script.Parent.AnimationController.BusGoesOff

    repeat

        Animations.BusGoesOff = Animator:LoadAnimation(BusGoesOff)

        wait()

    until Animations.BusGoesOff and Animations.BusGoesOff.Length > 0

end

Animations.BusGoesOff:Play()

This script seems to work just fine if I insert it in a script, but when I paste this code in a local script, then nothing happens and nothing appears in the output. I also want to make a function that only plays this when a player enters the game. Like a small introduction to the game. Can someone help me and re-make me the script or tell me what objects I need to put where please? Thank you very much. Have a nice day/night.

1
Is the local script in the workspace because local scripts only work in player gui, a players PlayerScripts, a players character, a players backpack, and the replicatedFirst service so if it isnt in one of these that might be why it doesnt work iamnotcool235_s 27 — 19d

Answer this question