I’m trying to get the animations to play with the animation controller but it’s not working right I’ve tried just about everything I could think of.
I’m thinking it could be an issue with the body movers. it’s like the humanoid states wont register but it’s like 50/50
This is the issue. It just slides
https://gyazo.com/72e41b268943599f7d3685457f3ffbad
Here is the odd results from my attempts
https://gyazo.com/89ed4b2724541f32278b1f1238a34673
I was making it walk and then I would quickly sit back down and the walk animation would play and get stick until I got back off the seat
I made the npc walk manually then added the saddle then it worked perfectly fine.
https://gyazo.com/5ab35cd70f5924057211203d5cf0048f
Here is the code for the animation controller in the npc
local Character = script.Parent.Parent
local Humanoid = script.Parent
local CurrentAnim
local Animation = Character:WaitForChild("AnimSaves")
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
local function PlayAnimation(AnimID)
local anim = Animation:FindFirstChild(AnimID)
if anim then
if CurrentAnim then
CurrentAnim:Stop()
end
CurrentAnim = Humanoid:LoadAnimation(anim)
CurrentAnim:Play()
end
end
function stopAllAnimations()
if (CurrentAnim ~= nil) then
CurrentAnim:Stop()
CurrentAnim = nil
end
end
function onRunning(speed)
print("Speed: ",speed)
if speed > 0.4 then
PlayAnimation("Walk")
pose = "Running"
else
PlayAnimation("Idle")
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
-- connect events
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
--Humanoid.Jumping:connect(onJumping)
--Humanoid.Climbing:connect(onClimbing)
--Humanoid.GettingUp:connect(onGettingUp)
--Humanoid.FreeFalling:connect(onFreeFall)
--Humanoid.FallingDown:connect(onFallingDown)
--Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
--Humanoid.Swimming:connect(onSwimming)
function stepAnimate(currentTime)
if (pose == "FreeFall") then
elseif (pose == "Seated") then
PlayAnimation("sit")
return
elseif (pose == "Running") and not CurrentAnim then
PlayAnimation("Walk")
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
end
end
PlayAnimation("Idle")
pose = "Standing"
while Character.Parent ~= nil do
wait(.1)
stepAnimate()
end
here is the code in the seat
Seat = script.Parent
local Hum = script.Parent.Parent.Parent:WaitForChild("Humanoid")
local Remotes = game:GetService("ReplicatedStorage"):WaitForChild("Remotes")
local LastOccupant = nil
Seat:GetPropertyChangedSignal("Occupant"):connect(function()
if not Seat.Occupant then
if LastOccupant ~= nil then
Remotes.DinoMenu:FireClient(LastOccupant, "UnMount")
if LastOccupant:FindFirstChild("PlayerData") then
if LastOccupant.PlayerData:FindFirstChild("CurrentMount") then
LastOccupant.PlayerData.CurrentMount.Value = nil
end
end
end
Seat.Disabled = true
else
LastOccupant = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent)
end
end)
while wait() do
if script.Parent.Parent.Parent:FindFirstChild("Humanoid") then
script.Parent.BodyAngularVelocity.AngularVelocity = Vector3.new(0,-Hum.WalkSpeed/3*Seat.Steer,0)
script.Parent.BodyVelocity.Velocity = Seat.CFrame.LookVector * (Hum.WalkSpeed * Seat.Throttle)
end
end