#Suspension car won't drive, despite copying all your scripts and property changes...

1 messages · Page 1 of 1 (latest)

untold spade
#

I acknowledge that in the comment section of the video there have been countless people speaking of their success with your tutorial so I'm not going to claim you were the one that did something wrong, because

1. It worked in your video

2. It worked for other people

Anyway, I will speak of my problem below:

#

Consider the following images:

#

If you look at the timestamps, the image on the right is screenshotted 1 second after the image on the left. In the video, Suphi's mouse doesn't click on any scripts at all in that window of time—It's as if the script appeared out of thin air. Considering the fact the localscript's name is "Drive", I can't help but feel that if my car isn't driving, it's probably because I never made a Drive script (but then again, like I said, I double-checked the video and didn't see any script created called "Drive)

onyx knot
#

The LocalScript he shows at 29:50 is the drive controller, he talks about how the input would affect the vehicleseat. The "Drive" script is probably just a reference he was using

untold spade
#

...
So then I thought, "Okay, maybe I did something wrong with the scripts I did copy from Suphi", and double-checked my scripts. The serverscript actually works fine for certain—and I placed print statements in the localscript, and they all printed correctly. Here's the code for the localscript:

#

???

#

it aint letting me paste the next message

onyx knot
#

I can't paste either

untold spade
#

did someone close it?

#

nvm

#

uh

#

wack

onyx knot
#

Do you get any errors or does it simply just not work?

untold spade
#

first half of LocalScript:

local character = script.Parent
local connection = nil

--> This connection triggers
character.Humanoid.Seated:Connect(function(active, seatPart)
        --> The following 3 lines functions correctly, I tested with print statements earlier
    if connection ~= nil then connection:Disconnect() connection = nil end
    if not seatPart then return end
    if seatPart.Name ~= "VehicleSeat" then return end
        --> The following line prints only once (which is how it should be)
    print("A")
    local constraintBL: CylindricalConstraint = seatPart.Parent.WheelBL.CylindricalConstraint
    local constraintBR: CylindricalConstraint = seatPart.Parent.WheelBR.CylindricalConstraint
    
    connection = seatPart.Changed:Connect(function(property)
        --print("B")
        if property == "SteerFloat" then
                        --> Prints whenever I press A or W
            print("X")
        ```
#

Second half:

elseif property == "ThrottleFloat" then
            local torque = math.abs(seatPart.ThrottleFloat) * seatPart.Torque
            print("seatPart.Torque is", seatPart.Torque) --> Prints 5000 or 0 depending on ThrottleFloat value
            print("seatPart.ThrottleFloat is", seatPart.ThrottleFloat)
            if torque == 0 then torque = 2000 end 
            
                        --> This does indeed set the MotorMaxTorque, I playtested and confirmed
            constraintBL.MotorMaxTorque = torque
            constraintBR.MotorMaxTorque = torque
            
                        --> angularVelocity either prints as 10000 or 0
            local angularVelocity = math.sign(seatPart.ThrottleFloat) * 10000
            print("math.sign(seatPart.ThrottleFloat) * 10000 is", angularVelocity)
            
                        --> Can confirm constraintBL and constraintBR have AngularVelocity set correctly
                        --> These always print 5000 or 0
            constraintBL.AngularVelocity = angularVelocity
            constraintBR.AngularVelocity = angularVelocity
            print("angularVelocityBL is", constraintBL.AngularVelocity)
            print("angularVelocityBR is", constraintBR.AngularVelocity)
        end
    end)
    
end)```
untold spade
#

Anyway, tested everything with printing and looked in the properties window, everything was set correctly

#

the car just didn't move

#

and then I thought "Okay, is something wrong with my car model?"

#

This is what happens:

#

(I hold W and then let go of W)

#

The car just refuses to move

#

The car suspension works, and nothing is anchored

#

Also, when I hold W, the car wheels don't spin either

#

so it's not like something is holding the car in place, right?

#

I can send a copy of the place file if anyone would like

onyx knot
#

sure i can test it

untold spade
onyx knot
#

The code is correct

#

So it means you messed something up with the attachments & constraints when setting them

#

your wheels are backwards

#

each side is spinning a different direction

untold spade
#

I'm using the BL wheel and the BR wheel. If the BL wheel is spinning forward and the BR wheel is spinning backwards, the car should start driving to the right, correct @onyx knot ?

onyx knot
#

ok so

#

the back wheels do spin when you hold W or S

#

obviously opposite directions

#

but i'm doing this with the car anchored in the air

#

and network ownership can't be called on anchored parts

#

so i'm trying to figure out if it's the network ownership or something with the car being on the ground that stops the wheels from spinning

#

@untold spade alr so it's something to do with when the car is on the ground the wheels can't spin, everything else works fine

untold spade
#

yep, just my luck

#

and this was my second attempt because my first one the springs didn't work

#

sometimes i hate developing 💀

onyx knot
#

@untold spade lmao fixed it

untold spade
#

????????????????????????????????

#

how

onyx knot
#

and because the wheels are backwards the controls are backwards

#

S goes forward

#

your spring min length was too low

untold spade
#

what does the spring min length have to do with anything

#

let me guess

#

wait

#

tell me

onyx knot
#

keeps the hull of the car off the wheels

untold spade
#

yeah that's such a stupid mistake

onyx knot
#

the car was basically sitting on the wheels

untold spade
#

can you send the fixed game file?

#

i mean i could probably fix it on my own but you have it just there

#

it's fine if you don't want to

onyx knot
#

it's a little changed from yours

#

just select the springs and increase the min length

untold spade
#

that's it?

onyx knot
#

yeah

#

and fix the damn wheels

untold spade
#

you didn't change the wheels?

#

oh

#

okay i'll go do that

#

what did you put the minlength to @onyx knot

onyx knot
#

trying to see the lowest that works rn

#

it works at 3

untold spade
#

k

#

it doesn't really matter how the wheels look

#

they're gonna be invisible anyway

#

i'm not plannign for it to be a car

#

it's supposed to look like a hovering vehicle

onyx knot
#

hold on

#

i forgot what i did now it's not working again lmao

#

ok it's fine

#

it's still kinda glitchy but that's one problem solved

untold spade
onyx knot
#

pretty much

untold spade
#

it might just be springconstraints

#

that are glitchy

#

Hey @random onyx are you willing to release a copy of the game file you used for your car suspension tutorial?

random onyx
#

your problem most likely is not the scripts did you setup the collision groups correctly?