Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a tool regenerate more than once?

I am making a game that opens in an hour "Code Hunters" and I added quests and you find tools. Now I want to make the tools regenerate every 2 minutes after somebody takes it. It does that but only regenerates once when I want it to continuously regenerate. What is wrong with my script?

Here is my script:

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

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


Please help~

1 answer

✓ Accepted answer

Make a copy of the tool and put it in ServerStorage. Then put a normal script into the tool and do this:

--This is editied to your preferences you gave me on Roblox

local tool = script.Parent

tool.AncestryChanged:connect(function()
        local newTool = game:GetService("ServerStorage"):WaitForChild("name of tool"):Clone()
        newTool.Parent = workspace
        newTool.CFrame = CFrame.new(x, y, z)
	wait(60 * 2)
end)

Make sure the tool in server storage also contains this script or else it will only be regenerate once.

3 comments

0

thank you so much! :D

0

sorry for being a bother, but how do I make it where it respawns 2 minutes after a player takes the item?

0

I've just edited it for you

This discussion is preserved as it was. New answers, comments, and votes are closed.