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

1 comment

0

code block pl