Not sure if this is still needed but i've re-wrote your script to include a percent bar on your text button. The code is as follows:
local STGui = game:GetService("StarterGui")
local Screen = STGui.ScreenGui
local PerBar_Props = {
ClassName = "Frame",
Parent = Screen,
Name = "Bar",
BackgroundColor3 = Color3.fromRGB(81, 38, 255),
BackgroundTransparency = 0.3,
Position = UDim2.new(0,0,0,0),
Size = UDim2.new(0,0,1,0),
ZIndex = 1,
Visible = false,
}
function createElement(Props)
local ClassName = Props.ClassName
local Obj = Instance.new(ClassName)
for k,v in pairs(Props) do
if(k ~= "ClassName") then
Obj[k] = v
end
end
return Obj
end
local text = game.StarterGui.ScreenGui.TextLabel
text.TextStrokeColor3 = text.BackgroundColor3
text.TextStrokeTransparency = 0
PerBar_Props.Parent = text
local PBar = createElement(PerBar_Props)
local howmany = 500
local Part_Props = {
ClassName = "Part",
Parent = workspace,
Position = Vector3.new(0,0.5,0),
Name = "Part"
}
for i=1,howmany do
local P = createElement(Part_Props)
wait(0.2)
text.Text = "parts ="..tostring(i)
local Percent = (i/howmany)
PBar.Visible = true
PBar.Size = UDim2.new(Percent,0,1,0)
end
The createElement() function is just a function that would create an object int this instance i create a frame that matches your textLabel Size and position then i also use it to create the parts. To target a property of your part just include the value inside the table Part_Props
Something like:
local Part_Props = {
ClassName = "Part",
Anchored = true,
Color = Color3.fromRGB(0,255,255),
Parent = workspace,
Position = Vector3.new(0,0.5,0),
Name = "Part"
}
Then re-run the script to see the changes. Though make sure you match the propety exactly otherwise the script will throw an error
Example:
local Part_Props = {
ClassName = "Part",
Parent = workspace,
color = Color3.fromRGB(0,255,255),
somethingelse = "blah",
Position = Vector3.new(0,0.5,0),
Name = "Part"
}
Hope this helps! :)
2 comments
thanks
HeroFig, please consider accepting the answer.