Hello! I'm making a game where you have to get teleported to another place to participate in rounds. During this you're greeted with a custom teleport screen with images that are meant to move down your screen. The script is meant to move an image down the screen, wait 10 seconds, clone a random child in the 'Images' folder, then finally destroy. Thus making a loop.
Keep in mind the script below is in each and every image in the 'Images' folder, the folder is in a ScreenGui under StarterGui. (Sorry if that confuses you.)
The problem I'm having trouble with:
After moving the images down for 10 seconds, I can't seem to get it to clone another image in the folder.
The script:
script.Parent.Images.Position = script.Parent.Position - UDim2.new(0,0,0,-0.01) wait(10) local items = script.Parent.Parent:GetChildren() local randomItem = items[math.random(1, #items)] local PickedItem = math.random(1, #items) PickedItem:Clone() wait() script.Parent:Destroy()
I know there are mistakes in here, and yes it's trash but you've got to start somewhere...
Any help is appreciated. Thank you!
script.Parent.Images.Position:TweenPosition(UDim2.new(script.Parent.Position) - UDim2.new(0,0,0,-0.01))) wait(10) local items = script.Parent.Parent:GetChildren() local randomItem = items[math.random(1, #items)] local PickedItem = math.random(1, #items) PickedItem:Clone() wait() script.Parent:Destroy()
Tell me if it works or not and I will fix It.