I am trying to make this clone a frame, and position them 75 studs(or whatever the term is for GUI's)
away from each-other, but this position's them all at the same position, can anyone tell me how to fix this problem?
Code:
for i,v in pairs(game.ReplicatedStorage.TestingFolder:GetChildren()) do local count = 0 local notification = script.Notification:Clone() notification.Parent = script.Parent count = count + 1 notification.Position = UDim2.new(0,0,0,75*count) end
Think about how you set up the script.
for i,v in pairs(game.ReplicatedStorage.TestingFolder:GetChildren()) do
repeats all the code in it each time. So, looking through this, I noticed that each time, it sets "count" back to zero. Lets say you iterated through the loop 3 times, the value of count each time would be set to zero, and then added 1 to it. (set to zero then add 1, reset to zero then add 1, reset to zero then add one) So how do you fix this? Easy, just define count before you start the loop, like below.
local count = 0 for i,v in pairs(game.ReplicatedStorage.TestingFolder:GetChildren()) do local notification = script.Notification:Clone() notification.Parent = script.Parent count = count + 1 notification.Position = UDim2.new(0,0,0,75*count) end