Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my Overhead Gui not function as intended?

Asked by 3 years ago

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:

01`local TitleGUI = game:GetService("ServerStorage"):WaitForChild("Title")
02game.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 >= 0 then
07            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
08            wait(2)
09            titleguiclone.TextLabel.Text = "Noob"
10        elseif Wins.Value >= 5 then
11            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
12            wait(2)
13            titleguiclone.TextLabel.Text = "Beginner"
14        elseif Wins.Value >= 10 then
15            titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
View all 56 lines...

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

Log in to vote
0
Answered by 3 years ago

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:

01local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid
02 
03humanoid.HealthChanged:Connect(function(health)
04    if humanoid.Health  <= 100 and 61 then -- this checks if the health is either 100 or higher then 61
05        script.Parent.ImageTransparency = 1
06    elseif humanoid.Health < 60 and  50 then -- the and in this checks if its higher then 50 but lower then 60.
07        script.Parent.ImageTransparency = 0.9
08    elseif humanoid.Health < 50 and 40 then
09        script.Parent.ImageTransparency = 0.8
10    elseif humanoid.Health < 40 and 30 then        -- Remember, this is a example.
11        script.Parent.ImageTransparency = 0.6
12    elseif humanoid.Health < 30 and 20 then
13        script.Parent.ImageTransparency = 0.4
14    elseif humanoid.Health < 20 and 5 then
15        script.Parent.ImageTransparency = 0.3
16    end
17end)

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

This code below should work the way you want it.

01local TitleGUI = game:GetService("ServerStorage"):WaitForChild("Title")
0202  game.Players.PlayerAdded:Connect(function(player)
0303      player.CharacterAdded:Connect(function(character)
0404          local titleguiclone = TitleGUI:Clone()
0505          local Wins = player.leaderstats.Wins
0606          if Wins.Value <= 4 and 0 then -- makes it only put the tag on there
0707              titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
0808              wait(2)
0909              titleguiclone.TextLabel.Text = "Noob"
1010          elseif Wins.Value <= 9 and 5 then
1111              titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
1212              wait(2)
1313              titleguiclone.TextLabel.Text = "Beginner"
1414          elseif Wins.Value <= 14 and 10 then
1515              titleguiclone.Parent = game.Workspace:WaitForChild(player.Name).Head
View all 56 lines...

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

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" Traadess 67 — 3y
0
Did you change your win value? It should work. Zeta_Dev 34 — 3y
0
Yea, I have eleven wins and the title I should have is "Decent" but it still says noob Traadess 67 — 3y
0
Wait nevermind, I tried it on an alt and it worked properly, I think it just doesn't work in studio. Anyways, tysm! Traadess 67 — 3y
0
No problem! Have a good night. Zeta_Dev 34 — 3y
Ad

Answer this question