What's wrong with the properties of VehicleSeat?

I’m stumped. I’ve made a simple code to mount and dismount a vehicle using a ProximityPrompt, but the Steer and SteerFloat properties go insane if you input too quickly. After double tapping an input, it starts throwing false positives.

local seat = script.Parent.Parent ----- Vehicle seat

local function start(player)
	task.wait()
	print(seat.SteerFloat)		
	if seat.Occupant ~= nil then
		start(player)
	else
		seat:SetNetworkOwner(nil)
		script.Parent.Enabled = true
	end
end

local function initialize(player)
	seat:SetNetworkOwner(player)
	seat:Sit(workspace:FindFirstChild(player.Name):FindFirstChildWhichIsA("Humanoid"))
	start(player)
end

script.Parent.Triggered:Connect(function(player) ----- Proximity prompt
	initialize(player)
end)

The output:

22:04:05.476 :arrow_forward: 0 (x2) - Server - Script:5
22:04:05.531 1 - Server - Script:5
22:04:05.543 :arrow_forward: 0 (x2) - Server - Script:5
22:04:05.587 1 - Server - Script:5
22:04:05.620 :arrow_forward: 0 (x2) - Server - Script:5
22:04:05.660 1 - Server - Script:5
22:04:05.676 :arrow_forward: 0 (x2) - Server - Script:5
22:04:05.726 1 - Server - Script:5
22:04:05.773 :arrow_forward: 0 (x2) - Server - Script:5
22:04:05.834 1 - Server - Script:5
22:04:05.847 :arrow_forward: 0 (x3) - Server - Script:5
22:04:05.900 1 - Server - Script:5
22:04:05.911 :arrow_forward: 0 (x2) - Server - Script:5
22:04:05.945 1 - Server - Script:5
22:04:05.964 :arrow_forward: 0 (x2) - Server - Script:5
22:04:05.995 1 - Server - Script:5
22:04:06.011 :arrow_forward: 0 (x2) - Server - Script:5
22:04:06.043 1 - Server - Script:5
22:04:06.059 :arrow_forward: 0 (x2) - Server - Script:5
22:04:06.092 1 - Server - Script:5
22:04:06.109 :arrow_forward: 0 (x209) - Server - Script:5

???

EDIT: Even simplifying the script even more doesn’t work, with it parented to VehicleSeat, it still steers left and right without any input…

local seat = script.Parent

seat.Changed:Connect(function(property)
	seat.Parent.FL.sc.TargetAngle = seat.SteerFloat * 45
	seat.Parent.FR.sc.TargetAngle = seat.SteerFloat * 45
	seat.Parent.rlt.HingeConstraint.AngularVelocity = seat.ThrottleFloat * 100
	seat.Parent.rrt.HingeConstraint.AngularVelocity = -seat.ThrottleFloat * 100
end)

Does it have to be local??

2 Likes

Just to point it out, Changed fires everytime any property of the seat changes. So it mite b ur issue. If u want to check if a specific property changed, use PropertyChangedSignal. Also when a player touches a seat it automatically seats them.

1 Like

I tried this with property change and it still jitters

local seat = script.Parent

local function steer()
	local SteerFloat = seat.SteerFloat
	if SteerFloat ~= 0 then
		seat.Parent.FL.sc.TargetAngle = SteerFloat * 45
		seat.Parent.FR.sc.TargetAngle = SteerFloat * 45
	else
		seat.Parent.FL.sc.TargetAngle = SteerFloat * 0
		seat.Parent.FR.sc.TargetAngle = SteerFloat * 0
	end
end

local function throttle()
	local ThrottleFloat = seat.ThrottleFloat
	if seat.ThrottleFloat ~= 0 then 
		seat.Parent.rlt.HingeConstraint.AngularVelocity = 0 
		seat.Parent.rrt.HingeConstraint.AngularVelocity = 0
	else 
		seat.Parent.rlt.HingeConstraint.AngularVelocity = 0
		seat.Parent.rrt.HingeConstraint.AngularVelocity = 0
	end
end

seat:GetPropertyChangedSignal("SteerFloat"):Connect(steer)

seat:GetPropertyChangedSignal("ThrottleFloat"):Connect(throttle)

Try using Steer rather than SteerFloat

1 Like
local seat = script.Parent

local function steer()
	local SteerFloat = seat.Steer
	if SteerFloat ~= 0 then
		seat.Parent.FL.sc.TargetAngle = SteerFloat * 45
		seat.Parent.FR.sc.TargetAngle = SteerFloat * 45
	else
		seat.Parent.FL.sc.TargetAngle = 0
		seat.Parent.FR.sc.TargetAngle = 0
	end
end

local function throttle()
	local ThrottleFloat = seat.Throttle
	if ThrottleFloat ~= 0 then 
		seat.Parent.rlt.HingeConstraint.AngularVelocity = ThrottleFloat * 100 
		seat.Parent.rrt.HingeConstraint.AngularVelocity = ThrottleFloat * 100
	else 
		seat.Parent.rlt.HingeConstraint.AngularVelocity = 0
		seat.Parent.rrt.HingeConstraint.AngularVelocity = 0
	end
end

seat:GetPropertyChangedSignal("Steer"):Connect(steer)

seat:GetPropertyChangedSignal("Throttle"):Connect(throttle)

I’m wondering if It’s because this is a server side script, but viewing the properties on client after spamming the input a couple times in the property window show it spazzing out too, ??

I think its a bug, since it had been covered in engine bugs for quite a while now.

Post regarding the bug

1 Like
local function initialize(player)
	local character = player.Character
	if character then
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			if humanoid.Health > 0 then
				seat:SetNetworkOwner(player)
				seat:Sit(humanoid)
				start(player)
			end
		end
	end
end

Not related to your issue but this is how you should fetch the player’s character’s humanoid instance.

1 Like