Hello everyone! I have this script, it is a car respawner, it works well expect for the fact that when it respawns, the car always respawns in the direction of where the previous one is, this is very annoying since im trying to make it spawn inside the parking lines. Does anyone know why it is doing this? It should be cloning the one in replicatedstorage. Im trying to make it clone straight.
That is your issue. You are cloning it, then immediately destroying it. Clone is working.
Edit: I tackled the wrong problem, I’ll scan through your code again, sorry. Just as a note, you can put three ``` above and below your code, to fomat it, like so:
RS = false
local button = script.Parent.Parent.Button
local car = game.ReplicatedStorage.PickupTruck
button.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
if RS == false then
RS = true
print(“Car respawning.”)
button.BrickColor = BrickColor.new(“Bright red”)
local clonecar = car:Clone()
clonecar:Destroy()
clonecar = script.Parent.Parent
clonecar:MoveTo(Vector3.new(503.5, 2.15, -501))
button.Position = Vector3.new(493.5, 2.15, -525.5)
wait(5)
button.BrickColor = BrickColor.new(“Bright green”)
RS = false
else
return
end
end
end)