In games it breaks after a while I have no idea why. Is there a better way of spawning things in? - thanks
debounce = true
script.Parent.Touched:connect(function(hit)
if debounce == true then
debounce = false
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum ~= nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local treasure = player.leaderstats.Treasure
if treasure.Value == 0 or treasure.Value > 0 then
treasure.Value = treasure.Value - 0
local ship1 = game.ReplicatedStorage.Ship1:Clone()
ship1.Parent = Workspace
ship1:MakeJoints()
wait(8)
debounce = true
else
debounce = true
end
end
end
end)
I solved it by respawning the spawners every 120 seconds incase they broke if anyone has this problem in the future.

1 comment
Ty