Preventing player from exiting the sitting state

Hello, today I was making a system that forces player’s to sit into a random seat, the issue I encountered is that, when the player jump’s they exit the siting the jumping animation and they just float awkwardly while being welded.

How would I prevent this kind of behaviour?

Here’s the video:

And here’s the code:

local SpawnPoints = workspace.Boat.Spawns:GetChildren()
local StartCutscene = require(game:GetService("ServerScriptService").StartCutscene)

local MPS = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		local HRP = character:FindFirstChild("HumanoidRootPart")

		wait(.1)

		for _,v in workspace.Boat.Main.BoatParts.Seats:GetChildren() do
			if v.Occupant == nil then
				v:Sit(humanoid)
				local Weld = Instance.new("Weld")
				Weld.Parent = v
				Weld.Part0 = v
				Weld.Part1 = HRP
				Weld.C1 = CFrame.new(0,-1,0)
			end
		end
		task.spawn(function()
			StartCutscene.StartBoatCutScene()	
		end)
	end)
end)

I have tried using Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,false)

Can you try to anchor the character after he sits?

This worked for me:

-- only the for loop since its the only thing I made changes to.
		for _,v in workspace.Seats:GetChildren() do
			if v.Occupant == nil then
				
				v:Sit(humanoid)

				local Weld = v.SeatWeld
				Weld.Part0 = v
				Weld.Part1 = HRP
				--Weld.C1 = CFrame.new(0,-1,0)
				humanoid.JumpPower = 0
				break
				
			end
		end
1 Like

I just did that, but it made it so the player is stuck in map spawn

for _,v in character:GetChildren() do
	if v:IsA("BasePart") then
		v.Anchored = true
	end
end

Worked like a char thank you a lot!

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