Car GUI script slow

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want my cars to drop to the baseplate faster

  2. What is the issue? when clicking the GUI to spawn a car you own, it takes about 1-2 full seconds to drop to the baseplate, if the user enters the car before that time period the car will not function.

  3. What solutions have you tried so far? I have tried moving them closer to the baseplate (I have them all hovering so the wheels don’t get stuck upon car spawn)

3 Likes

I didn’t understand your issue. Is your car delaying 1-2 seconds to spawn in the workspace or the car doesn’t work properly until those 1-2 seconds have passed?

So basically the car spawns but hovers slightly above the ground for 2 seconds, then you can see it physically fall onto the ground. After that you can enter and the car functions. However, if you enter the car before you physically see it fall, it will not function at all. That process takes about 1-2 seconds.

Could you send the spawn car script and screenshot the actual spawner object inside workspace?

Yep I can. Give me a few minutes to log into studio and I’ll take a quick clip of the issue as well

1 Like

How do you spawn your car? Do you just clone it and cframe it above the spawn? It also depends on how detailed your car may be, it may take a bit due to the amount of parts. It also may be a wait() or debounce in your script.

Or maybe an anchored part that gets unanchored through the car script.

1 Like

ok so here is a quick clip of the issue and also the equip script I am using.

local player = game:GetService(“Players”).LocalPlayer

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local remoteEventDisplayCar = ReplicatedStorage:WaitForChild(“DisplayCar”)

local button = script.Parent

local function onButtonActivated()

remoteEventDisplayCar:FireServer(“C8”)

end

button.Activated:Connect(onButtonActivated)

.Car issue.wmv (1.5 MB)

Please format your script, with ```lua

Also, what’s in your bindable event? Can you show us that script?

There’s nothing wrong with that script, send us the server script that handles the remote event.

We need to know what’s inside that one, we only know about how you call the script.

1 Like

sorry if this is wrong, I am actually not a scripter. but I believe this is what you asked for?

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local remoteEventDisplayCar = ReplicatedStorage:WaitForChild(“DisplayCar”)

local truck = ReplicatedStorage:WaitForChild(“2018 Ford F150 XLT”)
local jeep = ReplicatedStorage:WaitForChild(“2018 Jeep Wrangler”)
local Bugatti = ReplicatedStorage:WaitForChild(“Bugatti Divo”)
local C8 = ReplicatedStorage:WaitForChild(“C8”)
local lambo_green = ReplicatedStorage:WaitForChild(“Lambo green”)
local lambo_pink = ReplicatedStorage:WaitForChild(“Lambo pink”)

local displaying_car = false

local function DisplayCar(player, car)
spawn(function()
–wait(1)
local frame = player.Character:WaitForChild(“HumanoidRootPart”).CFrame
local newCar
frame = CFrame.new(frame.X+10, frame.Y, frame.Z)
if (car == “Truck”) then
newCar = truck:Clone()
elseif(car == “Jeep”) then
newCar = jeep:Clone()
elseif(car == “Bugatti”) then
newCar = Bugatti:Clone()
elseif(car == “C8”) then
newCar = C8:Clone()
elseif(car == “Lambo_green”) then
newCar = lambo_green:Clone()
elseif(car == “Lambo_pink”) then
newCar = lambo_pink:Clone()
else
warn (“Car not found”)
end
newCar.Parent = workspace
newCar:SetPrimaryPartCFrame(frame)
wait(5)
end)

end

remoteEventDisplayCar.OnServerEvent:Connect(DisplayCar)

1 Like

Yeah, it is not related to your scripts. Try checking for any anchored parts inside your cars, if there are any anchored parts just unanchor them.

1 Like

could it be an issue with how I copy/pasted them into my game from the studio session they were built in?

I basically just did a copy/paste into the workspace and made sure they were slightly hovering above the ground so as not to get stuck when they spawn.

No, that isn’t the issue. That shouldn’t affect the car spawning since you’re using SetPrimaryPartCFrame.

so I just checked the models themselves are anchored.

Unanchor them and test. If unanchoring them doesn’t work then it’s something related to the car script.

ok, thanks! appreciate all the help everyone.

1 Like

It would be good if you duplicated the cars and parented them to server storage as a backup in case your cars stop working when you unanchor them.

Does the car spawn far away from the player?
I think unanchored parts dont get affected by gravity unless a player is near the part.