Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I insert an animation using a script in to a VechileSeat?

Asked by 3 years ago
Edited 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

I need Help how to insert an animation to a vehicle seat using a script. I tried a lot of script but it wont work. How ever 1 script worked but the animation effected the other seats and vehicle seats as well.

Here is the the script I used for the object "VehicleSeat" , Object's Name: "Drive"( This script is affected to all sit. including object: Seat and Vechile Seat )

local NewAnimID = 5448926747 --PASTE NEW ANIMATION ID HERE
local function ReplaceAnimation(character, name, animId)
    local Animator = character.Animate
    local Animation = Instance.new("Animation")
    Animation.AnimationId = "http://www.roblox.com/asset/?id="..animId

    local ToolNone = Animator:FindFirstChild(name)
    if ToolNone then
        local NewAnim = Instance.new("StringValue")
        NewAnim.Name = name
        Animation.Name = name.."Anim"
        Animation.Parent = NewAnim
        ToolNone:Destroy()
        NewAnim.Parent = Animator
    end
end
game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        ReplaceAnimation(character, "sit", NewAnimID)
    end)
end)

Is their anything that I can Edit this script that can only effected to the VechileSeat that i want to have an animation and ** can not** affect other Seats and VehicleSeat

0
code block pl raid6n 2196 — 3y

Answer this question