Hey guys im not very good at scripting but I was wondering of you could help me add a debounce to this car spawning script?
this is also part of my cash script.
local replicatedStorage = game:GetService("ReplicatedStorage")
local datastore = game:GetService("DataStoreService")
local dsl = datastore:GetDataStore("StageSaveSystem")
game.Players.PlayerAdded:connect(function(plr)
local folder =Instance.new("Folder", plr)
folder.Name = "leaderstats"
local Cash = Instance.new("IntValue", folder)
Cash.Name = "Cash"
Cash.Value = dsl:GetAsync(plr.UserId) or 200
dsl:SetAsync(plr.UserId, Cash.Value)
Cash.Changed:connect(function()
dsl:SetAsync(plr.UserId, Cash.Value)
end)
end)
game.ReplicatedStorage:WaitForChild("CheckPrice").OnServerInvoke = function(player,NameOfCar)
return game.ServerStorage.Cars:FindFirstChild(NameOfCar).Price.Value
end
game.ReplicatedStorage:WaitForChild("SpawnCar").OnServerEvent:connect(function(player,NameOfCar)
local car = game.ServerStorage.Cars:FindFirstChild(NameOfCar):Clone()
car:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame + Vector3.new(0,0,15))
car.Parent = workspace
car:MakeJoints()
car.Name = player.Name…"'s "…NameOfCar
end)