Player won't sit when moved to seat

So I am trying to move a player to a seat when he steps onto a part, but somehow when he steps onto the part he moves to the seat but like 50% he won’t sit down but just stand on it. Can some one help me? By the way: I already used the :sit()

Code:

script.Parent.Touched:Connect(function(hit, player)

	local Hit = hit.Parent
	local playerName = hit.Parent.Name
	
	if hit.Parent:FindFirstChild('Humanoid') then
		
		Hit:MoveTo(game.Workspace.Boats:FindFirstChildWhichIsA('MeshPart'):FindFirstChild('MeshPart'):FindFirstChild('Part').Position)
		wait()
		game.Workspace.Boats:FindFirstChildWhichIsA('MeshPart'):FindFirstChild('MeshPart').Drive:Sit(hit.Parent:FindFirstChild('Humanoid'))
		hit.Parent:FindFirstChild('Humanoid').Sit = true
		hit.Parent:FindFirstChild('Humanoid').JumpPower = 0

		
	end
	







end)
4 Likes

Have you checked the hit? There is a chance hit is a accessory

2 Likes

Tried that but same result, but thanks

1 Like

If you want them to just Sit on the Seat when the Part is Touched then there isn’t a need to teleport them since the :Sit() function will do that for you. (Unless I’ve misinterpreted what you’re trying to get)

Give this ago and tell me if it works for you!

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local Humanoid = hit.Parent:FindFirstChild("Humanoid")		
		Humanoid.JumpPower = 0
		workspace.Boats:FindFirstChildWhichIsA("MeshPart"):FindFirstChild("MeshPart").Drive:Sit(Humanoid)
	end
end)
2 Likes

put prints around the script to see what’s not working. What doesn’t get printed in the output is the area of the problem.

script.Parent.Touched:Connect(function(hit, player)
print("TEST")
	local Hit = hit.Parent
print("TEST1")
	local playerName = hit.Parent.Name
	print("TEST2")
	if hit.Parent:FindFirstChild('Humanoid') then
		print("TEST3")
		Hit:MoveTo(game.Workspace.Boats:FindFirstChildWhichIsA('MeshPart'):FindFirstChild('MeshPart'):FindFirstChild('Part').Position)
print("TEST4")
		wait()
		game.Workspace.Boats:FindFirstChildWhichIsA('MeshPart'):FindFirstChild('MeshPart').Drive:Sit(hit.Parent:FindFirstChild('Humanoid'))
print("TEST5")
		hit.Parent:FindFirstChild('Humanoid').Sit = true
		hit.Parent:FindFirstChild('Humanoid').JumpPower = 0
print("TEST6")
		
	end
end)
3 Likes

Thank you that did the job, finally!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.