Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my Overhead Gui not function as intended?

I have a billboard GUI with a text label placed in server storage I also have a leaderstat named "Wins" I also have a script in serverscriptservice shown below:

`local TitleGUI = game:GetService("ServerStorage"):WaitForChild("Title")
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local titleguiclone = TitleGUI:Clone()
		local Wins = player.leaderstats.Wins
		if Wins.Value >= 0 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Noob"
		elseif Wins.Value >= 5 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Beginner"
		elseif Wins.Value >= 10 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Decent"
		elseif Wins.Value >= 15 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Very Decent"
		elseif Wins.Value >= 30 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Above Average"
		elseif Wins.Value >= 45 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Gamer"
		elseif Wins.Value >= 60 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Pro"
		elseif Wins.Value >= 75 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Amazing"
		elseif Wins.Value >= 100 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Awesome"
		elseif Wins.Value >= 115 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Ultra"
		elseif Wins.Value >= 150 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
			wait(2)
			titleguiclone.TextLabel.Text = "Chad"
		elseif Wins.Value >= 200 then
			titleguiclone.Parent = game.Workspace:WaitForChild(player.Name)
			wait(2)
			titleguiclone.TextLabel.Text = "The One"
		end
	end)
end)`

When I test out the game, it shows the overhead gui but the title always stays as "Noob" even though I have more than 5 wins. I've tried many things but nothing seems to work. Can someone please help?

1 answer

✓ Accepted answer

So the only one that would work would be 0, because there is no limiting. lets say i want to show a shade on someone's screen depending if their health is low enough, like in between 50 and 40 then it would get darker if it went to 40 to 30. I would have to write something like this:

local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid

humanoid.HealthChanged:Connect(function(health) 
	if humanoid.Health  <= 100 and 61 then -- this checks if the health is either 100 or higher then 61
		script.Parent.ImageTransparency = 1
	elseif humanoid.Health < 60 and  50 then -- the and in this checks if its higher then 50 but lower then 60.
		script.Parent.ImageTransparency = 0.9
	elseif humanoid.Health < 50 and 40 then
		script.Parent.ImageTransparency = 0.8
	elseif humanoid.Health < 40 and 30 then        -- Remember, this is a example.
		script.Parent.ImageTransparency = 0.6
	elseif humanoid.Health < 30 and 20 then
		script.Parent.ImageTransparency = 0.4
	elseif humanoid.Health < 20 and 5 then
		script.Parent.ImageTransparency = 0.3
	end
end)

the and inside the code is like the thing that limits it.

This code below should work the way you want it.

local TitleGUI = game:GetService("ServerStorage"):WaitForChild("Title")
02	game.Players.PlayerAdded:Connect(function(player)
03	    player.CharacterAdded:Connect(function(character)
04	        local titleguiclone = TitleGUI:Clone()
05	        local Wins = player.leaderstats.Wins
06	        if Wins.Value <= 4 and 0 then -- makes it only put the tag on there 
07	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
08	            wait(2)
09	            titleguiclone.TextLabel.Text = "Noob"
10	        elseif Wins.Value <= 9 and 5 then
11	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
12	            wait(2)
13	            titleguiclone.TextLabel.Text = "Beginner"
14	        elseif Wins.Value <= 14 and 10 then
15	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
16	            wait(2)
17	            titleguiclone.TextLabel.Text = "Decent"
18	        elseif Wins.Value <= 29 and 15 then
19	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
20	            wait(2)
21	            titleguiclone.TextLabel.Text = "Very Decent"
22	        elseif Wins.Value <= 44 and 30 then
23	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
24	            wait(2)
25	            titleguiclone.TextLabel.Text = "Above Average"
26	        elseif Wins.Value <= 59 and 45 then
27	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
28	            wait(2)
29	            titleguiclone.TextLabel.Text = "Gamer"
30	        elseif Wins.Value <= 74 and 60 then
31	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
32	            wait(2)
33	            titleguiclone.TextLabel.Text = "Pro"
34	        elseif Wins.Value <= 99 and 75 then
35	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
36	            wait(2)
37	            titleguiclone.TextLabel.Text = "Amazing"
38	        elseif Wins.Value <= 114 and 100 then
39	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
40	            wait(2)
41	            titleguiclone.TextLabel.Text = "Awesome"
42	        elseif Wins.Value <= 149 and 115 then
43	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
44	            wait(2)
45	            titleguiclone.TextLabel.Text = "Ultra"
46	        elseif Wins.Value <= 199 and 150 then
47	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
48	            wait(2)
49	            titleguiclone.TextLabel.Text = "Chad"
50	        elseif Wins.Value <= 100000 and 200 then
51	            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name)
52	            wait(2)
53	            titleguiclone.TextLabel.Text = "The One"
54	        end
55	    end)
56	end)

I hope this resolved your problem. Have a good day!

  • Zeta

5 comments

0

Thanks for the well written response Zeta, I actually appreciate it but unfortunatley I tried your method and it does the same the my code does. It just doesn't change the text to anything other than "Noob"

0

Did you change your win value? It should work.

0

Yea, I have eleven wins and the title I should have is "Decent" but it still says noob

0

Wait nevermind, I tried it on an alt and it worked properly, I think it just doesn't work in studio. Anyways, tysm!

0

No problem! Have a good night.

This discussion is preserved as it was. New answers, comments, and votes are closed.