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

Why is this Regeneration Script not working properly?

can anyone point out the error with this code - it seems to be "grammatically" fine but when it runs i get the following error ""The Parent property of Map1 is locked, current parent: NULL, new parent Workspace""

yours - goku

local map = game.Workspace.Map1 
map.Parent = game.ServerStorage
local mapCopy = map:Clone()
local mapCopy 
local function Regen()
	wait(6)
	mapCopy:destroy()
	mapCopy.Parent = game.Workspace	
	wait(3)
end

mapCopy.Parent = game.Workspace
while true do
	Regen()
end

3 comments

0

if you want any more information just ask and ill be happy to awnser

0

Please use code blocks

0

sorry just realized that -once again sorry for my insolence ill fix if up now

1 answer

✓ Accepted answer

It was a little hard to read what your script exactly said due to it not being in code blocks but I believe the following code will do exactly what you are trying to do:

local StoredMap = game:GetService("ServerStorage").Map1  --//Location of stored map.

local function Regen()
	wait(6)
	game.Workspace:FindFirstChild("Map1"):Destroy()  --//Remove copy from Workspace.
	wait()
	local Copy = StoredMap:Clone() --//Clone copy from Server Storage.
	Copy.Parent = game.Workspace --// Insert new copy.
end

while true do
	Regen() --//Run the regen function.
end

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