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

Selfmade Data Storage?

game.Workspace.OBJECT:clone()
game.Workspace.OBJECT.MoveTo:Lighting()
wait(50)
repeat until finished
break
end
end

I need some help fixing this. I'm trying to get this script to store data that happens every 50 seconds. Meant for it to be a rapid storage script. Not working so well.

2 answers

You have one main problem that will prevent your code from working.

Half of it isn't Lua.



  • Line 1 is useless because you never do anything with the clone. You're just creating an object with a nil Parent doing nothing but taking up space and adding lag.

  • MoveTo is a method, not a property, so we use a colon, :.

  • MoveTo does not change an object's parent. It simply moves that object to a desired Vector3 location. To change a parent, just edit it like you would any other property. game.Workspace.Part.Parent = game.Lighting

  • There is no method named Lighting.

  • The wait(50) is useless because you do nothing after it.

  • This script will not repeat every 50 seconds, because it's not inside a loop.

  • The repeat loop is useless because it doesn't do anything. You're essentially telling the computer to repeat nothing. For repeat loops to work, you must put what you want it to repeat between the repeat and the until keywords, then put the condition after the until. repeat code until condition is the correct format.

  • finished is a nil value because you never define it anywhere. Placing random, undefined, English words inside your code is never a good idea.

  • Your break keyword is useless because it's not inside a loop.

  • Your two ends are not needed. You only need an end when a new scope is created, but an exception to this is the repeat loop, because it's ended by the until keyword instead. This makes both ends, in your code, pointless.

Please work on your basic coding skills.

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