I know if you change that to false or just jump the npc will stop sitting. The rest I didn’t look at.
try checking
print(Humanoid:GetState())
It should be saying “Running” if not then
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, false)
Do this for other extraneous humanoid state types as well.
Hope this helped, happy scripting
it still prints running when the bug happens, I think it might be the waypoints because the bug makes it not get past Humanoid.MoveToFinshed:Wait() for a few seconds then repeats
oh I just figured out that it’s not the sitting, even when the sitting code is removed the bug still happens what could be causing this?
Have you tried making the NPC jump? Roblox will automatically handle removing the welds and playing the animations when using Jump.
There are two ways for making the NPC use jump. The first method below uses the humanoid’s Jump value, which is the default for server control over the NPC’s jump:
function module.CustomerServed(player, customer, hairChosed)
local char = player.Character
char:PivotTo(customer.HumanoidRootPart.CFrame * CFrame.new(0,0,2))
task.wait(1.5)
player.Coins.Value = giveCoins(player.Coins.Value)
player.PlayerGui.Coins.CoinFrame.CoinCounter.Text = player.Coins.Value
local hair = game.ReplicatedStorage.HairStyles:FindFirstChild(hairChosed)
local hairClone = hair:Clone()
print(customer.Name)
hairClone.Parent = customer.Head
hairClone.Handle1:WaitForChild("AccessoryWeld").Part1 = customer.Head
task.wait(1)
customer.Humanoid.Jump=true
customer.HumanoidRootPart.Position = customer.HumanoidRootPart.Position + Vector3.new(0,0,-5)
path(customer, workspace.SpawnLocation.Position)
customer:Destroy()
end
The second method, which is more reliable (works in LocalScripts, too), is by setting the HumanoidState to Jumping.
function module.CustomerServed(player, customer, hairChosed)
local char = player.Character
char:PivotTo(customer.HumanoidRootPart.CFrame * CFrame.new(0,0,2))
task.wait(1.5)
player.Coins.Value = giveCoins(player.Coins.Value)
player.PlayerGui.Coins.CoinFrame.CoinCounter.Text = player.Coins.Value
local hair = game.ReplicatedStorage.HairStyles:FindFirstChild(hairChosed)
local hairClone = hair:Clone()
print(customer.Name)
hairClone.Parent = customer.Head
hairClone.Handle1:WaitForChild("AccessoryWeld").Part1 = customer.Head
task.wait(1)
customer.Humanoid:ChangeState('Jumping')
for_,anim in pairs(customer.Humanoid.Animator:GetPlayingAnimationTracks()) do
if anim.Name == "SitAnim" then
anim:Stop()
break
end
end
customer.HumanoidRootPart.Position = customer.HumanoidRootPart.Position + Vector3.new(0,0,-5)
path(customer, workspace.SpawnLocation.Position)
customer:Destroy()
end
However, this method can cause the NPC to jump in mid-air if it’s already jumping or off the seat. (Which is highly unlikely)
If you’re having any problems with the script, please let me know and i’ll be able to help you.