Cars stuck to ground

My cars/trucks won’t move if the tires are touching the ground before the game loads. I’m using perfect weld so the car needs to start out anchored. I’ve searched online but haven’t really found much. So far my solution has been to “float” them in studio, then when the game loads it drops them down to the ground. Is there some way to avoid floating them? I’m pretty new to this and really appreciate any help.

Nevermind. After more reading it looks like floating them is the answer. Sorry.

From what you have said it sounds like you are welding the cars to your baseplate. I would have a look at your weld script and see what it is doing that could be causing this

1 Like

Will post what I have in just a minute. Thank you for replying!

– Created by Quenty (@Quenty, follow me on twitter).
– Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
– Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it’ll fix them.

–[[ INSTRUCTIONS

  • Place in the model
  • Make sure model is anchored
  • That’s it. It will weld the model and all children.

THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.

This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
]]

–[[ DOCUMENTATION

  • Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
  • Will work in PBS servers
  • Will work as long as it starts out with the part anchored
  • Stores the relative CFrame as a CFrame value
  • Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  • Utilizes a recursive algorith to find all parts in the model
  • Will reweld on script reparent if the script is initially parented to a tool.
  • Welds as fast as possible
    ]]

– qPerfectionWeld.lua
– Created 10/6/2014
– Author: Quenty
– Version 1.0.3

– Updated 10/14/2014 - Updated to 1.0.1
— Bug fix with existing ROBLOX welds ? Repro by asimo3089

– Updated 10/14/2014 - Updated to 1.0.2
— Fixed bug fix.

– Updated 10/14/2014 - Updated to 1.0.3
— Now handles joints semi-acceptably. May be rather hacky with some joints. :confused:

local NEVER_BREAK_JOINTS = false – If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).

local function CallOnChildren(Instance, FunctionToCall)
– Calls a function on each of the children of a certain object, using recursion.

FunctionToCall(Instance)

for _, Child in next, Instance:GetChildren() do
	CallOnChildren(Child, FunctionToCall)
end

end

local function GetNearestParent(Instance, ClassName)
– Returns the nearest parent of a certain class, or returns nil

local Ancestor = Instance
repeat
	Ancestor = Ancestor.Parent
	if Ancestor == nil then
		return nil
	end
until Ancestor:IsA(ClassName)

return Ancestor

end

local function GetBricks(StartInstance)
local List = {}

-- if StartInstance:IsA("BasePart") then
-- 	List[#List+1] = StartInstance
-- end

CallOnChildren(StartInstance, function(Item)
	if Item:IsA("BasePart") then
		List[#List+1] = Item;
	end
end)

return List

end

local function Modify(Instance, Values)
– Modifies an Instance by using a table.

assert(type(Values) == "table", "Values is not a table");

for Index, Value in next, Values do
	if type(Index) == "number" then
		Value.Parent = Instance
	else
		Instance[Index] = Value
	end
end
return Instance

end

local function Make(ClassType, Properties)
– Using a syntax hack to create a nice way to Make new items.

return Modify(Instance.new(ClassType), Properties)

end

local Surfaces = {“TopSurface”, “BottomSurface”, “LeftSurface”, “RightSurface”, “FrontSurface”, “BackSurface”}
local HingSurfaces = {“Hinge”, “Motor”, “SteppingMotor”}

local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end

return false

end

local function ShouldBreakJoints(Part)
— We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
– definitely some edge cases.

if NEVER_BREAK_JOINTS then
	return false
end

if HasWheelJoint(Part) then
	return false
end

local Connected = Part:GetConnectedParts()

if #Connected == 1 then
	return false
end

for _, Item in pairs(Connected) do
	if HasWheelJoint(Item) then
		return false
	elseif not Item:IsDescendantOf(script.Parent) then
		return false
	end
end

return true

end

local function WeldTogether(Part0, Part1, JointType, WeldParent)
— Weld’s 2 parts together
@param Part0 The first part
@param Part1 The second part (Dependent part most of the time).
@param [JointType] The type of joint. Defaults to weld.
@param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
@return The weld created.

JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")

local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
	Name = "qCFrameWeldThingy";
	Part0  = Part0;
	Part1  = Part1;
	C0     = CFrame.new();--Part0.CFrame:inverse();
	C1     = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
	Parent = Part1;
})

if not RelativeValue then
	RelativeValue = Make("CFrameValue", {
		Parent     = Part1;
		Name       = "qRelativeCFrameWeldValue";
		Archivable = true;
		Value      = NewWeld.C1;
	})
end

return NewWeld

end

local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
@param Parts The Parts to weld. Should be anchored to prevent really horrible results.
@param MainPart The part to weld the model to (can be in the model).
@param [JointType] The type of joint. Defaults to weld.
@parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.

for _, Part in pairs(Parts) do
	if ShouldBreakJoints(Part) then
		Part:BreakJoints()
	end
end

for _, Part in pairs(Parts) do
	if Part ~= MainPart then
		WeldTogether(MainPart, Part, JointType, MainPart)
	end
end

if not DoNotUnanchor then
	for _, Part in pairs(Parts) do
		Part.Anchored = false
	end
	MainPart.Anchored = false
end

end

local function PerfectionWeld()
local Tool = GetNearestParent(script, “Tool”)

local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]

if PrimaryPart then
	WeldParts(Parts, PrimaryPart, "Weld", false)
else
	warn("qWeld - Unable to weld part")
end

return Tool

end

local Tool = PerfectionWeld()

if Tool and script.ClassName == “Script” then
— Don’t bother with local scripts

script.Parent.AncestryChanged:connect(function()
	PerfectionWeld()
end)

end

– Created by Quenty (@Quenty, follow me on twitter).

Hmm I don’t think it is the weld code, I think its the code in the jeep from the sample games. The jeeps in the sample games don’t have a weld code and it still locks to the ground if you move the jeep and it touches the ground.

Found the solution. The only way around this is in Studio, the “Model” tab and then uncheck “Join Surfaces.” That causes a whole mess of other issues though so I’m just going to float the cars just above the surfaces in studio still.