I have a delay in this script to stop it cloning the item hundreds of time, but it doesn't seem to work and I don't know why, instead it clones the item infinite times leading to my studio crashing:
local Character = script.Parent
local Humanoid = Character.Humanoid
local Torso = Character.Torso
local Delay = false
function OnDeath()
if Delay == true then
return;
end
Delay = true
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Body = ReplicatedStorage:WaitForChild(" ")
local BodyClone = Body:Clone()
Instance.new("Humanoid", BodyClone)
BodyClone.Parent = game.Workspace
end
Humanoid.Died:connect(OnDeath)

3 comments
You never set the Delay to "true" anywhere in the script.
Does "Body" have a script inside it? The Body dies as soon as it is cloned into workspace, which triggers a script, etc...
Deleted my last comment. It was uncalled for.