Hello, I'm having a problem cloning a model after destroying it, here is my code.
amount = 1
banana = game.Workspace.Banana
banana.Archivable = true
function onTouched(Banana)
local h = Banana.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Bananas")
if (score~=nil) then
score.Value = score.Value + amount
script.Parent:Destroy()
wait(3)
script.Parent:Clone()
end
end
end
end
end
script.Parent.Touched:connect(onTouched)

3 comments
You can't clone a model after destroying it.
^ this. Also you're using a couple deprecated terms like "findFirstChild" and "connect." Use "FindFirstChild" and "Connect" instead.
Thank you! This helped.