****This is the third time the first time someone helped, but it duplicated itself like 15 times and made my game laggy! Second time nobody replied. Please Help!

On my game Code Hunters my script for my tool regeneration keeps regenerating, but not after somebody takes it like I want! Please help me make it where when a Robloxian takes it the tool regenerates!

Scripts!

Before:

local clone = script.Parent.Torch:Clone(999999999999999999)
while true do wait(120)
	local g = script.Parent:findFirstChild("School Book")
	if g ~= nil then

	else
		local o = clone:Clone()
		o.Parent = script.Parent
		o:MakeJoints()
	end
end 

After:

local tool = script.Parent
while true do 
        local newTool = game:GetService("ServerStorage"):WaitForChild("Glasses"):Clone()
        newTool.Parent = workspace
        newTool.CFrame = CFrame.new(x, y, z)
    wait(120 * 2)

end

3 comments

0

Bind the cloning to a function that checks when the tool is no longer in the workspace.

0

Does it throw an error?

0

How?