I’m making a GUI car spawner but everytime I click the GUI, it tells me I can’t spawn because the car doesn’t exist in ServerStorage.
Proof car is in server storage:
Script:
local player = game.Players.LocalPlayer
local db = false
local carLimit = 1
local cars = 0
script.Parent.MouseButton1Click:Connect(function(GetCar)
if cars < carLimit then
if db == false then
if player.Team == game.Teams.FBI then
db = true
Mod = game:GetService("ServerStorage"):FindFirstChild("FbiCruiser")
clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
player.Character.HumanoidRootPart.CFrame = clone.DriveSeat.CFrame
wait(100)
db = false
end
else
script.Parent.BackgroundTransparency = 0
script.Parent.BackgroundColor3 = Color3.fromRGB(255,0,0)
wait(3)
script.Parent.BackgroundTransparency = 1
script.Parent.BackgroundColor3 = Color3.fromRGB(255,255,255)
end
else
script.Parent.BackgroundTransparency = 0
script.Parent.BackgroundColor3 = Color3.fromRGB(255,0,0)
wait(3)
script.Parent.BackgroundTransparency = 1
script.Parent.BackgroundColor3 = Color3.fromRGB(255,255,255)
end
end)
Error
Players.LMVM2041.PlayerGui.FBICarSpawner.Frame.ScrollingFrame.FBICAR.LocalScript:12: attempt to index nil with 'clone'