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
What is the issue? Include screenshots / videos if possible!
Well the VectorVelocity of LinearVelocity din’t change
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)
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)