Gui won't update

  1. What do you want to achieve? A promotion GUI for a security group I’m developing for.

  2. What is the issue? When I click the Update List button it will not update the list.

  3. What solutions have you tried so far? I have tried cloning the GUI, recreating it. But nothing will work.

Here is my code

-- Group & Ranks
local GID = 7482300
local Rank1 = 2
local Rank2 = 3
local Rank3 = 4
local Rank4 = 5
local Rank5 = 6
local Rank6 = 7
local Rank7 = 8

-- Point Requirements
local Rank1Req = 15
local Rank2Req = 30
local Rank3Req = 45
local Rank4Req = 80
local Rank5Req = 120
local Rank6Req = 170
local Rank7Req = 230

local debounce = false

script.Parent.MouseButton1Click:Connect(function()
	if debounce == false then
		debounce = true
		print(debounce)
		for i,v in pairs(script.Parent.Parent.List:GetChildren()) do
			if v:IsA("Frame") then
				v:Destroy()
			end
			wait()
		end
		wait(1)
		for number,player in pairs(game.Players:GetPlayers()) do
			if player:IsInGroup(GID) then
				if player.leaderstats.Credits.Value <= 15 then	
					if player:GetRankInGroup(GID) <= 1 and player:GetRankInGroup(GID) >= 7 then
						local clone = Instance.new("Frame",script.Parent.Parent.List)
						clone.Size = script.Gui.Size
						local TL1 = Instance.new("TextLabel",clone)
						TL1.Size = script.Gui.Name.Size
						TL1.Position = script.Gui.Name.Position
						TL1.Name = script.Gui.Name.Name
						local TL2 = Instance.new("TextLabel",clone)
						TL2.Size = script.Gui.CR.Size
						TL2.Position = script.CR.Name.Position
						TL2.Name = script.Gui.CR.Name
						local TL3 = Instance.new("TextLabel",clone)
						TL3.Size = script.Gui.NR.Size
						TL3.Position = script.NR.Name.Position
						TL3.Name = script.Gui.NR.Name
						local TL4 = Instance.new("TextLabel",clone)
						TL4.Size = script.Gui[">"].Size
						TL4.Position = script.Gui[">"].Position
						TL4.Name = script.Gui[">"].Name
						local name = player.Name
						clone.Visible = true
						clone.Name = number"-"..name
						clone.Name.Text = name
						clone.CR.Text = player:GetRoleInGroup(GID)
						if player.leaderstats.Credits.Value <= Rank1Req and player.leaderstats.Credits.Value >= Rank2Req then
							clone.NR.Text = "[LR]Trained Hawkins"
						else
							if player.leaderstats.Credits.Value <= Rank2Req and player.leaderstats.Credits.Value >= Rank3Req then
								clone.NR.Text = "[LR]Hawkins Elite Security"
							else
								if player.leaderstats.Credits.Value <= Rank1Req and player.leaderstats.Credits.Value >= Rank4Req then
									clone.NR.Text = "[MR]Hawkins Tier 1"
								else
									if player.leaderstats.Credits.Value <= Rank1Req and player.leaderstats.Credits.Value >= Rank5Req then
										clone.NR.Text = "[MR]Hawkins Tier 2"
									else
										if player.leaderstats.Credits.Value <= Rank1Req and player.leaderstats.Credits.Value >= Rank6Req then
											clone.NR.Text = "[MR]Hawkins Tier 3"
										else
											if player.leaderstats.Credits.Value <= Rank1Req and player.leaderstats.Credits.Value >= Rank7Req then
												clone.NR.Text = "[MR]Hawkins Tier 4"
											else
												if player.leaderstats.Credits.Value <= Rank7Req then
													clone.NR.Text = "[MR]Hawkins Elite"
												end
											end
										end
									end	
								end
							end
						end
					end
				end
			end
		end
		wait(2.5)
		debounce = false
		print(debounce)
	end
end)

I just want to know why it wont work and would prefer to not be given a whole script.

1 Like

Hmm, I’m not sure what update means in this context, but your Gui’s are definitely cloning. The thing is your for loop can run before you want it to update. Because to update you have to click the button, but at the same the conditions can be met by your loop and therefore you guis can clone beforehand

I would probably using a .Changed or GetPropertyChangedSignal on your credits. I also feel you’ve missed some ends and the code is quite nested. What I would suggest is look through your gui objects and the explorer when testing, to see what’s happening. As well as using prints to debug. From the second large part of your script, you’re creating clones on end, without it correlating to group rank or etc. It seems the only thing being changed in relation to something is clone.Nr.Text.

Also. So the problem is quite vague.

1 Like

by update i mean remove the current ones then add every new one that is needed

1 Like

So then what’s the issue? Is the new one’s not being added? Is you cloning not working or is you leaderstats clone text not working?

1 Like

Correct. The new one will not appear

1 Like

Hmm, can you try adding a print after this line. Also can you try using one clone instead of 4?

1 Like