You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to make it work when the player sits on it
-
What is the issue? It keeps getting stuck somehow when the player sits and try to drive it
-
What solutions have you tried so far? I tried looking on dev forum internet and even hidden devs but no one helped me
I tried alot of things but i’m not sure if i did them correctly, for example i changed the frictionweight to 100 and even made the axels can collide off because i saw on a similar post that it fixed his problem but didn’t work.
--\\\ Services ///
local WAGON = script.Parent
local Cart = WAGON:WaitForChild("Cart")
local Base = Cart:WaitForChild("Base")
local Driver_Seat = Cart:WaitForChild("VehicleSeat")
local Wheels = WAGON:WaitForChild("Wheels")
local Motors = {}
local Driving = false
-- \\\ Functions ///
function INIT()
for _, object in pairs(Wheels:GetDescendants()) do -- get motors
if object:IsA("HingeConstraint") then
print('hotspot')
table.insert(Motors, object)
end
end
end
function PreventFling()
task.wait(.1)
--Base.Anchored = not Base.Anchored
end
function OnDriven()
print(Driver_Seat.Throttle)
task.wait(.5)
if Driver_Seat.Throttle ~= 1 and Driver_Seat.Throttle ~= 0 then return end -- check if its advancing or stopping to advance
if Driver_Seat.Throttle == 1 then -- when advancing
Driving = true
elseif Driver_Seat.Throttle == 0 then -- when going back
Driving = false
end
if Driving then
for _, motor in pairs(Motors) do
motor.AngularVelocity = 400
end
else
for _, motor in pairs(Motors) do
motor.AngularVelocity = 0
end
end
end
INIT()
Driver_Seat:GetPropertyChangedSignal("Occupant"):Connect(PreventFling)
Driver_Seat:GetPropertyChangedSignal("Throttle"):Connect(OnDriven)
Don’t mind the brainrot prints
