I want to achieve the A-Chassis car teleporting properly. It works in studio, but it literally explodes in the game (wheels get yeeted everywhere and the car turns into a “garry’s mod glitching prop”). I think it might be the A-Chassis system itself, since I have tried a ton of variants to try and get it fixed, but nothing helped. I couldn’t find the documentation for A-Chassis too, so it’s even more annoying.
The teleporter works by checking if the object that touched it is a vehicle or not (by name or parent), and then if it’s a vehicle it’s checking if it has a primary part, and if it doesn’t have one it creates the part with model’s extent size, welds it and sets it as the primary part, then it’s changing the model’s primary part’s CFrame and after the teleport it deletes the primary part if it was created artificially.
It’s not the primary part model that is the problem, since even if there is a primary part it’s still getting yeeted, and the reason that it works in studio and doesn’t in actual player is because studio doesn’t have any latency, and somehow having slight latency breaks the whole thing.
Script:
local model = script.Parent
local tpSetupFailed = false
local teleportSettings = {
touchMode = 0, -- Touch modes: 0 - triggerPad.Touched | 1 - triggerPad.TouchEnded (0 default, recommended)
debounceTime = 1
}
local debounceList = {}
------- TriggerPad
local triggerPad = model:FindFirstChild("Pad")
if not triggerPad then tpSetupFailed = true warn("No trigger pad detected in "..model.Name.."!") end
------- LocationPads
local locationPads = {}
for _,pad in pairs(model:GetChildren()) do
if pad:IsA("Part") and pad.Name == "ToPad" then
table.insert(locationPads,pad)
end
end
if #locationPads == 0 then tpSetupFailed = true warn("No location pads detected in "..model.Name.."!") end
------- Teleport Fail Check
if tpSetupFailed then error("Failed to setup for teleport "..model.Name.."!") end
------- Teleport
function teleport(object)
if object.Parent:FindFirstChild("Humanoid") then
for i,v in pairs(debounceList) do
if v == object.Parent then return end
end
table.insert(debounceList,object.Parent)
local humanoid = object.Parent:FindFirstChild("Humanoid")
if humanoid and not humanoid.Sit and humanoid.Health > 0 then
local randomPad = math.random(#locationPads)
object.Parent:MoveTo(locationPads[randomPad].Position)
end
wait(teleportSettings.debounceTime)
for i,v in pairs(debounceList) do
if v == object.Parent then table.remove(debounceList,i) end
end
end
if object.Parent.Parent.Parent.Name == "Vehicles" then
for i,v in pairs(debounceList) do
if v == object.Parent.Parent.Parent then return end
end
table.insert(debounceList,object.Parent.Parent.Parent)
local randomPad = math.random(#locationPads)
if object.Parent.Parent.PrimaryPart then
object.Parent.Parent:PivotTo(CFrame.new(locationPads[randomPad].CFrame.Position))
else
local newPP = Instance.new("Part")
newPP.CanCollide = false
newPP.Transparency = 1
newPP.CFrame, newPP.Size = object.Parent.Parent:GetBoundingBox()
object.Parent.Parent.PrimaryPart = newPP
object.Parent.Parent:PivotTo(CFrame.new(locationPads[randomPad].CFrame.Position))
newPP:Destroy()
end
wait(teleportSettings.debounceTime)
for i,v in pairs(debounceList) do
if v == object.Parent.Parent.Parent then table.remove(debounceList,i) end
end
end
end
------- Teleport Trigger Events
if teleportSettings.touchMode < 1 then
triggerPad.Touched:Connect(function(object)
teleport(object)
end)
else
triggerPad.TouchEnded:Connect(function(object)
teleport(object)
end)
end