NPC isn't snapping to the ground

Hello friends,

I have a npc which is positioned in the deck of a flying ship (the ship goes up and down using tween animations).

When I run the studio on the very first 10-12 seconds the NPC simply floats in the air when the ship goes down and sink in the ship mesh when the ship goes up, after this time (~10 seconds), everything starts to work fine.

I have absolutely no clue on what am I doing wrong, so hopefully somebody can assist me with this issue.

Just in case, I’m also attaching a picture of the NPC part hierarchy and some other properties.

NPC Parts:

Humanoid Props:

I would like to thank in advance and apologise if this post is misplaced. It’s my very 1st on Roblox Dev forums.

1 Like

This may be because it is not anchored.

1 Like

Well if you anchor the NPC it just move with out animation. so it is better you think something else then just anchor the NPC.

Maybe use welds that may help like it does with cars.

1 Like

Well what I don’t get is the reason for this erratic behaviour… not sure if you guys watched it, but it works like expect after a few seconds.

Regardless thanks for the replies.

@BaggyChris how anchor the Humanoid would help to fix the issue? Also what you mean by welds? I think the welding is alright, I mean I know it’s alright for animation purposes at the very least, the only part I don’t have welded is the HumanoidRootPart, because I’m not sure where to weld it too. Do you think it may be the issue?

Thanks

Post your tween script here, that could be the issue.

Is the ship made out of meshes, and if so, can you walk on it like the npc did? If you can, then you should turn on PreciseCollision if that’s what it’s called, it has happened to others before.

1 Like

Video shows him walking on the ship. Also it works fine after ~10 seconds so this couldn’t be the issue.

What is it using to move? Teleportation? Pathfinding service? An animation?

Usually if there is an animation that is poorly coordinated and the ship is a mesh (you can walk on it normally true/false doesn’t matter) it can cause flying of the npc.

1 Like

Fist of all thanks for the reply @ReplacedLetter,

The tween script is connected to the Airship, and seems to be working fine, also my player walks perfectly on top of the Airship, regardless here it is:

local goalUp = {}
local goalDown = {}

local upY = AirshipPos.Y + 2
local posUp = Vector3.new(AirshipPos.X, upY, AirshipPos.Z)
goalUp.Position = posUp

local downY = AirshipPos.Y - 2
local posDown = Vector3.new(AirshipPos.X, downY, AirshipPos.Z)
goalDown.Position = posDown

local tweenInfo = TweenInfo.new(8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

local tweenUp = TweenService:Create(Airship.PrimaryPart, tweenInfo, goalUp)
local tweenDown = TweenService:Create(Airship.PrimaryPart, tweenInfo, goalDown)

tweenUp.Completed:Connect(function(playbackState)
    tweenDown:Play()
end)

tweenDown.Completed:Connect(function(playbackState)
    tweenUp:Play()
end)

tweenUp:Play()
1 Like

Thanks for the reply,

Yes made out a few meshes, all of them with collision set to PreciseCollision, and yes I can walk perfectly on the very same place the npc is walking.

Thanks for the reply @ImTheBuildGuy, I’m using humanoid:MoveTo.

Can you post your :MoveTo() script in your NPC?

Sure can, here it is:

local movementCycle = 0

local function movement()

	if movementCycle == 1 then
		walkingAnimationInstance:Stop()
		telescopingAnimationInstance:Play()
		movementCycle = 2
		wait(6)
		movement()
	
	elseif movementCycle == 2 then
		telescopingAnimationInstance:Stop()
		walkingAnimationInstance:Play()
		local newPosition = Vector3.new(-92.205, 28.167, -1.088)
		humanoid:MoveTo(newPosition)

	
	elseif movementCycle == 3 then
		walkingAnimationInstance:Stop()
		telescopingAnimationInstance:Play()
		movementCycle = 4
		wait(6)
		movement()
		
	elseif movementCycle == 4 then
		telescopingAnimationInstance:Stop()
		walkingAnimationInstance:Play()
		local newPosition = Vector3.new(-98.446, 28.167, -0.03)
		humanoid:MoveTo(newPosition)
		
	elseif movementCycle == 5 then
		walkingAnimationInstance:Stop()
		telescopingAnimationInstance:Play()
		movementCycle = 6
		wait(6)
		movement()
		
	elseif movementCycle == 6 then
		telescopingAnimationInstance:Stop()
		walkingAnimationInstance:Play()
		local newPosition = Vector3.new(-105.154, 28.167, 0.045)
		humanoid:MoveTo(newPosition)
		
	elseif movementCycle == 7 then
		walkingAnimationInstance:Stop()
		telescopingAnimationInstance:Play()
		movementCycle = 0
		wait(6)
		movement()
		
	else
		movementCycle = 0
		telescopingAnimationInstance:Stop()
		walkingAnimationInstance:Play()
		local newPosition = Vector3.new(-99.079, 26.324, -11.731)
		humanoid:MoveTo(newPosition)	
		
	end
end


humanoid.MoveToFinished:Connect(function (reached)
	movementCycle = movementCycle + 1
	print ('m cycle is now')
	print (movementCycle)
	movement()
end)

 movement()

After a lot of tests I couldn’t reproduce this so I have no idea why it is doing that. Hopefully someone with more knowledge runs across this post and has the solution. Good luck!

Hey, no worries man,

Really appreciate the time and effort, I’m sure at some point I’m going to get this thingy fixed.
I guess the reason why you couldn’t reproduce it was because you didn’t have the Airship mesh.

Just had an idea, obviously feel free to refuse, but I think I can add you to the project team so you can see exactly what’s going on… let me know if you feel like do it.

Once again, thanks.

Hey guys, just want to share an update to my issue:

Doing some extra test, I managed to capture this little video:

The instance on top is the server, the instance below is the client, as you can see… for a pretty much the same time (~10 seconds) the NPC behaves perfectly (server side) and wrongly client side, after this time the problem (which isn’t really a problem) is the other way around.

I’m pretty sure is that what may be causing the issue is the fact the ballon is animated at client level, where’s the NPC is get spawned from the replicated storage.

I think just by moving the ballon to the replicatedStorage may fix the issue, although I’m not 100% that’s the right medicine.

So before do anything I would like to hear from more experience devs like you guys.

Once again, I want to thank in advance for the help.

Sorry for late response, was busy all weekend. In the top video the ship doesn’t seem to be tweening at all. Are you tweening it locally?

If you want to do that I can try to help there.