Tower of Hell typed Progress Bar not functioning as intended

My friend made some code for a Tower of Hell styled game, this is for a progress bar and it does not seem to be working… With the Lua Code block below can anyone spot the error, and help me with fixing it?

StarterGui of the ProgressBar (Local Script is the Lua Code block below:)
image

local replicatedStorage = game:GetService("ReplicatedStorage")

local totalSize = 1000000000

local tower = workspace:FindFirstChild("Tower")
if not tower then return end

for _, child in pairs(script.Parent.Frame:GetChildren()) do
	if child:IsA("Frame") then
		child:Destroy()
	end
end

for _ , section in pairs(tower:GetChildren()) do
	local frame = Instance.new("Frame")
	frame.Size = UDim2.new(1, 0, section.PrimaryPart.Size.Y/totalSize, 0)
	frame.Name = section.Name
	frame.BorderSizePixel = 0
	frame.BackgroundColor3 = section.PrimaryPart.Color
	frame.Parent = script.Parent.Frame
end

thanks!

Follow up to the previous reply;
Perhaps a picture of the viewport would be helpful as well, if only there is any unintentional visual behaviour.

Since it was my friend who scripted this, and he is in bed of the time of me making this reply… I might try to re-make it. Any tips, any functions I may need?

I have no idea what works and what dossent, you see. Thats why i posted this, to see if you guys could see the error. No errors where printed in the output

This is very horrid, and may be the reason as to why your script isn’t working right. This will completely stop the script if the tower isn’t loaded for the client when this runs. Do workspace:WaitForChild("Tower") to effectively yield the script until the tower has loaded.

1 Like

I am gonna use a method of having…

A Folder in workspace called “Sections” and every 3 minutes it randomly selects 6 sections and puts them inside a model in workspace called tower, and randomises there locations, then i have a part that detects the closest section (putting those parts at the starts of the sections) and detecting the closest one, then naming them there number place in the Tower. Then with the progress bar it saves the data from the closest part, the frame accesses that is the name of the section number (frames having section names 1,2,3 etc…) and then copying a value inside of that section (Color3 Value) and changing the frames color to that value…

image

Getting a error in the output, it might not be going into the Tower model

This means that Tower is not a direct child of workspace at runtime. Where is the tower parented to?

The Tower is parented to workspace

Since i cant script very well i used a disaster script to generate the sections, i think that they are generating to worspace instead of my Tower model…

While testing the game, check to see if the tower is parented to workspace.

Hmm… the Tower model is in workspace, but so is all the sections

Try renaming the “Tower” to “Section”

@Owen_Hevalide2 i think you need add a folder into the Lightning,Folder called ¨Phases¨,and make stages number but not same number.

Why Lightning? Why does ReplicatedStorage exist anyways?

just, my friend did in Lightning.

So just a question.
what about the progress bar isn’t working?

This wouldn’t work. If every child is name Frame, it won’t do anything.

Because it has its own script.