This script won't work?

Hey there. I’m not exactly the best scripter, and I need help here.

So, I’m trying to have a model reset after a certain amount of time, but for some reason, it won’t work. Could you all help me?

Gamereset = False
Wait (2000)
Gamereset= True

object = script.Parent.Parent.Parent.Parent.Parent
if (object ~= nil) and (object ~= game.Workspace) then 
model = object 

messageText = "Draining the facility!" 

message = Instance.new("Message")
message.Text = messageText 
backup = model:clone()  
waitTime =10  
wait(math.random(0, waitTime)) 
while wait(waitTime) do 

    message.Parent = game.Workspace 
    model:Destroy()

    wait(1) 
    model = backup:clone() 
    model.Parent = game.Workspace 
    model:makeJoints() 
    message.Parent = nil 
   end 
end

I apologize if I appear to be incompetent, as I kind of am with the whole scripting thing. Thanks!

Here is no functions, and :remove() is deprecated

I cannot seem to find an answer as the code is messy and hard to read, try “beautifying your code”
Instead of

while true do 
wait(waitTime)
message.Parent = game.Workspace 
model:Destroy() 

wait(1) 

model = backup:clone() 
model.Parent = game.Workspace 
model:makeJoints() 
message.Parent = nil 
end 
end

Try

while wait(waitTime) do 

    message.Parent = game.Workspace 
    model:Destroy()

    wait(1) 
    model = backup:clone() 
    model.Parent = game.Workspace 
    model:makeJoints() 
    message.Parent = nil 
   end 
end

Also im pretty sure the “Message” object is deprecated
Use :Destroy() instead of :Remove()

local model = game.Workspace.Model
while true do
local Clone = model:Clone()
Clone.Parent = game.Lighting
wait(20)--Wait time here
model:Destroy()
Clone.Parent = workspace
model = Clone

end

Hope this helps you!

Try this

local waitTime = 2000
local object = script.Parent.Parent.Parent.Parent.Parent
local obj
local messageText = "Reseting" 
function reset()
	local message = Instance.new("Message", game.Workspace)
	message.Text = messageText 
	local waitTime2 = 10 
	wait(waitTime2)
	message:Destroy()
	obj:Clone().Parent = object.Parent
	object:Destroy()
end

function start()
	obj = object:Clone()
	obj.Parent = game.Lighting
end

while wait(waitTime) do
	reset()
end

start()

Huge thanks to all of you! I’ll be trying these as soon as I get back on studio. Thanks again!

Edit: sorry this was meant to be a reply to the original post, not a specific on. My apologies!

Also, this is small, but I’m pretty sure Wait(2000) should be wait(2000).

Edit: Also you have a couple grammatical errors (not syntax) which may not matter, but just watch out for that.

I’ve now seen some of them, that is my fault. Thanks for pointing it out. I do know everything is spelled correctly in the actual script luckily.