debounce = false
storage = game.ServerStorage:WaitForChild("VehicleStorage")
deal = script:WaitForChild("Dealer")
cooldown = false

script.Parent.ClickDetector.MouseClick:connect(function(plr)
	newGui = deal:clone()
	cars = storage:GetChildren()
		for i, v in ipairs(cars) do
		local button = deal.Main.DefaultButton:Clone()
		button.Name = "Button"..i
		button.Text = v.Name
		button.Visible = true
		button.Parent = newGui.Main
		button.Position = UDim2.new(0,0, (.05 * (i-1)), 0)
	end
		newGui.Parent=plr.PlayerGui		
end)

game.ReplicatedStorage.ChooseVehicle.OnServerEvent:connect(function(client, event, pad)
local player = client
if pad == script.Parent and cooldown == false then
local carChoice = storage:FindFirstChild(event)
		newCar = carChoice:clone()
		newCar.Parent = game.Workspace
		newCar:MoveTo(script.Parent.Position)
		cooldown = true
		wait(10)
		cooldown = false
end
end)

1 comment

0

if PLAYER:IsInGroup(ID) then