Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When I resize my car's base, it doesn't drive?

Asked by 3 years ago

I have been making a car. It works, but when I resize the base and reposition the wheels, it doesn't drive - it just sits there. Can somebody tell me where I've gone wrong? Thanks!

2 answers

Log in to vote
0
Answered by
Y_VRN 246 Moderation Voter
3 years ago
Edited 3 years ago

Are you using surface hinges?

Well, I'm sorry to tell, but part surfaces, including Weld, SmoothNoOutline, and others, including Hinge are no longer supported by ROBLOX just recently (unless if it is an old, unedited model.) You'll have to use the newer Constraints system.

Here's an article which could help you get started: https://developer.roblox.com/en-us/articles/Constraints

Unless you're already using Constraints, you may need to use a script and use a VehicleSeat to make it work.

--- If you already know how to code, then you may skip this part ---

Add a script to the VehicleSeat and open the script editor via clicking on the script.

Then, paste this in the script:

local str, str1, mot, mot1 = script.str, script.str1, script.mot, script.mot1
-- You may edit these, but it is best to move the Constraints under this script
-- if you have no experience with code.

local speed = 100 -- Edit the number if you want to go slow or fast.
local maxSteer = 20 -- If you have steering in your vehicle, edit this.
                    -- Make sure the wheels don't collide with the base.

function Steer()
    str.TargetAngle = -maxSteer * script.Parent.Steer
    str1.TargetAngle = -maxSteer * script.Parent.Steer

    -- NOTE: This is made for HingeConstraints. Never use it for other types.
    -- NOTE: Hinges may not steer like the other depending on how you set your
    --       vehicle up. Try fixing your setup, or edit the values inside this
    --       function.
end

function Move()
    mot.AngularVelocity = -speed * script.Parent.Throttle
    mot1.AngularVelocity = speed * script.Parent.Throttle
    -- NOTE: This is made for HingeConstraints. Never use it for other types.
    -- NOTE: Hinges may not move like the other depending on how you set your
    --       vehicle up. Try fixing your setup, or edit the values inside this
    --       function.
end
Steer() Move() -- Just to steady both hinges.
script.Parent:GetPropertyChangedSignal("Steer"):Connect(Steer)
script.Parent:GetPropertyChangedSignal("Throttle"):Connect(Move)

Also, please add more details to your questions, especially if you future questions are a little more complex.

*quick fix - just some minor errors in my answer**

Ad
Log in to vote
0
Answered by
322ita 15
3 years ago

I think u have to redo the thing u did before resizing It

An example its:im making a custom character and when i test It works,when i resize It It Dosent work because some objects in the model like motor6d hot desteoyed so you need to resetup the thing

Answer this question