I am working on an NPC that mimics your movement, it mimics it, but when it’s stating the animation that is playing, it does not return Jump most of the time, how would I improve the jump anim detection?
local state = hum:GetState()
local new = Instance.new("Part")
new.Anchored = true
new.CanCollide = false
new.Transparency = 0.99
new.Parent = workspace.PlayerPathPoints:FindFirstChild(script.Parent.Name)
local stringvalue = Instance.new("StringValue",new)
stringvalue.Name = "CurrentAnim"
if script.Parent.Humanoid.MoveDirection ~= Vector3.new(0,0,0) and state == Enum.HumanoidStateType.Running then
currentanim = "Walk"
end
if script.Parent.Humanoid.MoveDirection == Vector3.new(0,0,0) and state == Enum.HumanoidStateType.Running then
currentanim = "Idle"
end
if state == Enum.HumanoidStateType.Jumping then
currentanim = "Jump"
end
if state == Enum.HumanoidStateType.Freefall then
currentanim = "Fall"
end
if state == Enum.HumanoidStateType.Climbing then
currentanim = "Climb"
end
if state == Enum.HumanoidStateType.Landed then
currentanim = "Idle"
end
if currentanim ~= nil then
stringvalue.Value = currentanim
end
Using a local script and then setting the network owner of the character to myself, I was able to achieve this in few lines of code (p.s make sure to copy the default animation scripts and shove it in the dummy)
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Hum2Copy = Character:WaitForChild("Humanoid")
local Dummy = workspace.Dummy
local DummyHum = Dummy:WaitForChild("Humanoid")
Hum2Copy:GetPropertyChangedSignal("MoveDirection"):Connect(function()
DummyHum:Move(Hum2Copy.MoveDirection)
end)
Hum2Copy.StateChanged:Connect(function(NewState)
DummyHum:ChangeState(NewState)
end)
Looking at the clip you sent, I forgot to tell you my reference, I was remaking Super Mario Galaxy 2’s Cosmic Clones which do what you do but with a delay, so if I climb a truss, he will do that as well