How do i fix this issue with my loading bar?

This may be the wrong place to put it but I was working on a loading screen and every time I test the game out the loading bar is outside where it should be. (Those white borders). So how can I fix this? (This may be the wrong place so forgive me if it is.

3 Likes

probably parent the white bar inside the bar thing with the outline, if that doesnt work are you using code to modify its position? We need more context

It is parented and no im not using code. If you want I can share my code

Ok so right now it has no code that does anything with the bar?
If thats the case how are you setting the position of the bar? Are you using scale or offset?

Perhaps I’ll just share you my loading screen code

-- TheUltimateLifeFormU
-- 06.15.2024

-- AN ADVANCED LOADING SCREEN TO LET IN-GAME ASSETS PRELOAD FIRST

-- // VARIABLES //

-- Getting the basic services
local tweServ = game:GetService("TweenService")
local repFrst = game:GetService("ReplicatedFirst")
local contProv = game:GetService("ContentProvider")

local loadables = game:GetDescendants() -- gets everything in this game that can be loaded
local loadUI = script.PT_LOADING_SCREEN_UI:Clone() -- Clones the loading UI
local plr = game.Players.LocalPlayer
local plrGui = plr:WaitForChild("PlayerGui")

repFrst:RemoveDefaultLoadingScreen() -- Makes the default loading screen shorter, doesnt really remove it.

local loaded = false
local cancelled = false

loadUI.Parent = plrGui -- P[arents the UI to the players PlayerGui Instance.

-- // MAIN CODE //

-- // ACTUAL LOADING SECTION //

game.Loaded:Wait()
local totalAssets = #loadables -- Variable for all total asseta in the game
for i = 1, #loadables do
	
	contProv:PreloadAsync({loadables[i]})
	amount_loaded = i
	loadUI.MAIN_FRAME.LOADING_BAR.LOADING_AMOUNT.Text = i.. " / " ..totalAssets
	loadUI.MAIN_FRAME.LOADING_BAR.LOADING_PERCENTAGE.Text = math.round((i/totalAssets) * 1000)/10 .. "%" -- Percentage text (demicals)
	loadUI.MAIN_FRAME.LOADING_BAR.BAR.Size = UDim2.new(amount_loaded/totalAssets, 0,1,0)
	
end

-- // FINISHED LOADING //
wait(1.5)
loadUI:Destroy() -- Destroys the loading screen once finished loading that wait it wont show again after reset

whats the anchor point of the bar?

the default anchor point (0,0)?

Can you show me a video of you testing it?

whats the bar look like before play testing?
Sorry for the basic questions just trying to get all the details

Heres the image

last question, can I see the workspace of your UI?

image

Welp sorry to say but I have no idea, I’ve never seen this sort of thing happen, Ill try and think on it and see if I can figure it out

Would you be willing to copy that screen gui to a separate baseplate and upload the file?

Sure thing. Just give me a minute to do that.

Don’t worry about doing it right now. I won’t be able to look at it for a couple of days.

  • How come?
  • Well thats fine, but I’ll upload it here just in case I forget. I’m one to forget myself very easily

LoadingScreen.rbxm (12.6 KB)

Right, I think I see the issue. It appears that you’ve set the scale on the Y axis’s size to -0.882 and set the Y axis position scale to 0.942. Meaning that it’s positioned near the bottom of its parent but compensating by making its size go negative. You should be fine if you just set the Y axis size to 1 and the Y axis position to 0. However, it does seem as though you want there to be a gap between the outline and the loading bar, so you could probably achieve something similar by using the UIPadding element.

Hope this helps.