Ive made this code below and it duplicates the car from server storage and spawns it in a certain place, my problem is if someone is to spawn a different car the old one will still be there and the spawn button can be pressed multiple times and the cars will spawn on each other is there a way I could alter this script?
script.Parent.MouseButton1Click:connect(function(GetCar)
Mod = game.ServerStorage.BMW330DCIV
clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
end)
I also have a local script in the button too which teleports the player to the car and deactivates the Gui which is here
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
player.Character.HumanoidRootPart.CFrame = CFrame.new(-19.3, 1.05, 57.68)
script.Parent.Parent.Parent.Enabled = false
end)
thanks

5 comments
You can make a debounce.
sorry but that doesn't really help
A debounce always helps, especially for this situation. Also edit your code to include the code block.
@Dovydas1118 Your idea is good. Debounces are really helpful in situations like these.
Im relatively new to scripting so could you help me with making a script that does that or giving me information on how id go about it thanks