If don't change value when :GetPropertyChangedValue

You can write your topic however you want, but you need to answer these questions:

So i have a vehicle seat that when throttle 1, -1 or 0, it will change the
linearvelocity VectorVelocity

  1. What is the issue? Include screenshots / videos if possible!

    Well the VectorVelocity of LinearVelocity din’t change

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

    I try looking but i can’t find something related

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local Base = script.Parent.Parent.Base --The body of part
local AngularVelocity = Base.AngularVelocity
local LinearVelocity = Base.LinearVelocity

local Seat = script.Parent -- Vehicle Seat
local Throttle = Seat.Throttle
local Steer = Seat.Steer

local AngularValue = Vector3.new(0,0,-0.3)
local LinearValue = Vector3.new(0,3,0)

local RAngularValue = Vector3.new(0,0,0.3)
local RLinearValue = Vector3.new(0,-3,0)

-----------------------------------------------------------------

Seat:GetPropertyChangedSignal("Throttle"):Connect(function(Move)
	print("Someone Throttle It Up")
	if Throttle == 1 then
		LinearVelocity.VectorVelocity = LinearValue
		print(LinearVelocity.VectorVelocity)
	end
	if Throttle == -1 then
		LinearVelocity.VectorVelocity = RLinearValue
	end
	if Throttle == 0 then
		LinearVelocity.VectorVelocity = Vector3.new(0,0,0)
	end
	
end)

Okay when when the vehicle seat throttle to 1,-1 or 0, the linearvelocity dint change? i can’t figured it out

Is your Throttle a value object? If so then I’d recommend saying Throttle.Value instead of just Throttle when using the if statement:

Seat:GetPropertyChangedSignal("Throttle"):Connect(function(Move)
	print("Someone Throttle It Up")
	if Throttle.Value == 1 then
		LinearVelocity.VectorVelocity = LinearValue
		print(LinearVelocity.VectorVelocity)
	end
	if Throttle.Value == -1 then
		LinearVelocity.VectorVelocity = RLinearValue
	end
	if Throttle.Value == 0 then
		LinearVelocity.VectorVelocity = Vector3.new(0,0,0)
	end
	
end)

no the Throttle is a property of a VehicleSeat

When you put a value of a property to a variable:

  • once the property changes, the variable stays the same as before,
  • when you override the variable, the property does not change.

To fix this, don’t use the Throttle variable, instead replace it with Seat.Throttle.

Exactly what this guy said lol. To elaborate, since your setting a variable to the property under Seat called “Throttle” the server won’t think the property has changed since it was only defined previously once. So yeah just do Seat.Throttle ever time for an if statement, or change the variable of throttle to the newly changed property:

Seat:GetPropertyChangedSignal("Throttle"):Connect(function(Move)
	print("Someone Throttle It Up")
	if Seat.Throttle == 1 then
		LinearVelocity.VectorVelocity = LinearValue
		print(LinearVelocity.VectorVelocity)
	end
	if Seat.Throttle == -1 then
		LinearVelocity.VectorVelocity = RLinearValue
	end
	if Seat.Throttle == 0 then
		LinearVelocity.VectorVelocity = Vector3.new(0,0,0)
	end
	
end)
2 Likes

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