How to make player stay seated on a tweened model?

local run = game:GetService("RunService")
local seat = script.Parent

local weldConnection

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if seat.Occupant then
		local c0 = seat.SeatWeld.C0
		local c1 = seat.SeatWeld.C1
		local humanoid = seat.Occupant
		local character = humanoid.Parent
		local hrp = character.HumanoidRootPart
		weldConnection = seat.ChildRemoved:Connect(function(child)
			if child.Name == "SeatWeld" then
				run.Stepped:Wait()
				local weld = Instance.new("WeldConstraint")
				weld.Name = "SeatWeld"
				weld.Part0 = seat
				weld.Part1 = hrp
				weld.Parent = seat
				
			end
		end)
	end
end)

this script uses weldconstraints, but it didnt work.

As I said, use WeldConstraint to weld the character and the seat when the character is seated. You can detect if the character is sitting using :GetPropertyChangedSignal("Occupant") and check if the seat.Occupant is there, which you did. The problems here are:

  1. You are playing with Weld which is unnecessary because you will be using WeldConstraint
  2. You are only adding the WeldConstraint if the Weld is gone, which is not the right way to do it. You have to add the WeldConstraint immediately when the character is seated.
  3. You didn’t use WeldConstraint immediately when the character is seated.

Note that you can put WeldConstraint in the seat manually and set Part0 property to the seat. Then you can just change the Part1 property to the character’s HumanoidRootPart or torso once the character is seated.

local run = game:GetService("RunService")
local seat = script.Parent



seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if seat.Occupant then
		local humanoid = seat.Occupant
		local character = humanoid.Parent
		local hrp = character.HumanoidRootPart
		local seat = script.Parent

		run.Stepped:Wait()
		local weld = Instance.new("WeldConstraint")
		weld.Name = "SeatWeld"
		weld.Part0 = seat
		weld.Part1 = hrp
		weld.Parent = seat
		end				
end)

i just tried this, also didnt work.

No errors right? Then try printing inside the :GetPropertyChangedSignal() event, specifically inside if seat.Occupant then meaning

if seat.Occupant then
   print("this is a test")
end

and tell us if it prints. The event just might not fire.

The event does fire, just tried it and it does print.

Have you tried anchoring the character? (It might still kick them off the seat though)

Alright, try checking if the WeldConstraint exists when you are seated. It’s absolutely supposed to weld you along with the seat.

Note: Also, tell us if there’s any new “changes”.

The rest of the vehicle should be anchored (including the seat), it shouldn’t be welded as those welds will break when the vehicle is tweened (the script I provided is specifically for the seat’s weld between the seat and the player’s character).

It just kicks them off the seat in the air.

the weldconstraint does exist but it just gets disabled whenever the plane gets tweened.

You mean disabled as in the WeldConstraint.Enabled property being set to false?

Alright the last thing would be to update the player’s position ALWAYS, if he’s inside the seat, update his position to be on top of the seat

If it doesnt work then last thing would be for u to send us the game file

1 Like

Use qPerfectionWeld for this. There’s an option for “Never-Break-Joints”, which could be beneficial to you. (You can also take apart the code and just utilize the never break joints part.)

2 Likes

yes, that’s what i mean. It just happens whenever it tweens.

how would I use qperfectionweld in this scenario?

Yep this works! I just updated the players position to be on top of the seat and anchored the humanoidrootpart. Then just unanchored it whenever the player jumps.

1 Like

I guess it’s a module that uses normal welds but allows further configuration, for like he said, setting it to never break