So ive been working on an animation to enter the car so it looked better overall, i did the animation and even tested it with npcs, but when i play it in-game with a script, the position of the character is wrong (as seen in the 2 comparisons below)
with an npc:
in-game: (ignore the black sky its for testing purposes)
here is the script that i used:
local Seat = script.Parent
function added(child)
if (child.ClassName == "Weld") then
human = child.part1.Parent:FindFirstChild("Humanoid")
if human ~= nil then
anim = human:LoadAnimation(Seat.GetInAnimation)
anim:Play()
end
end
end
function removed(child)
if anim ~= nil then
anim:Stop()
anim:Remove()
end
end
Seat.ChildAdded:Connect(added)
Seat.ChildRemoved:Connect(removed)
i dont know what is wrong in here, i used other characters as reference to center the animation as most as possible but i cant get it to work.
any help is appreciated!
--//Variables
local Seat = script.Parent
--//Controls
local Animation = nil
--//Functions
Seat.ChildAdded:Connect(function(child)
if not child:IsA("Weld") then
return
end
local Humanoid = child.part1.Parent:FindFirstChildWhichIsA("Humanoid")
if Humanoid then
for i, animation in ipairs(Humanoid.Animator:GetPlayingAnimationTracks()) do
animation:Stop()
end
Animation = Humanoid.Animator:LoadAnimation(Seat.GetInAnimation)
Animation:Play()
end
end)
Seat.ChildRemoved:Connect(function()
if not Animation then
return
end
Animation:Stop()
Animation:Remove()
end)
it works, thanks, but the problem comes when the animation plays:
for some reason the movement in the animation is very different from the original one used on an npc or in the animator itself
thats the only issue im currently having right now.