The script below is for a EXP Orb so when someone collects it,it should be Destroyed and after awhile,It would be Cloned and pop back again but I don't see it.
They said there is something on line 15 but I don't know whats wrong,the Output doesn't tell anything. Can anyone help?
local db = true
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if db == true then
db = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.leaderstats.XP.Value = player.leaderstats.XP.Value + 1
wait()
script.Parent:Destroy()
end
end
end)
while true do
if db == false then
db = true
wait(3)
script.Parent:Clone()
end
end

4 comments
The Parent of the script gets destroyed before the script has waited 3 seconds
^ destroying the script's parent will destroy it's descendants as well
you forgot to set the clone's parent
You would be better off with a script placed somewhere else. You can also do the clone in the touched event so you are not wasting processing power in a pointless while loop