onlyjakep
(jakep)
February 25, 2022, 11:03am
1
Hello, I am working on a division system, its 3AM and nothing is working for me, please help!
game.Players.PlayerAdded:Connect(function(player)
if game.Players.LocalPlayer.leaderstats.Wins.Value > 0 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif
if game.Players.LocalPlayer.leaderstats.Wins.Value > 24 then
script.Parent.Text == "CURRENT DIVISION: ".. "PRO"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 48 then
script.Parent.Text == "CURRENT DIVISION: ".. "ELITE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 88 then
script.Parent.Text == "CURRENT DIVISION: ".. "MASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 125 then
script.Parent.Text == "CURRENT DIVISION: ".. "GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 250 then
script.Parent.Text == "CURRENT DIVISION: ".. "CHAMPION FINALS"
else
print("halal mode") then
end
end)
Try this, If its inside a text, Make sure its in local script
if game.Players.LocalPlayer.leaderstats.Wins.Value > 0 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 24 then
script.Parent.Text = "CURRENT DIVISION: ".. "PRO"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 48 then
script.Parent.Text = "CURRENT DIVISION: ".. "ELITE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 88 then
script.Parent.Text = "CURRENT DIVISION: ".. "MASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 125 then
script.Parent.Text = "CURRENT DIVISION: ".. "GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 250 then
script.Parent.Text = "CURRENT DIVISION: ".. "CHAMPION FINALS"
else
print("halal mode")
end
daulric
(Ulric)
February 25, 2022, 11:09am
4
for the value put >=
example:
game.Players.LocalPlayer.leaderstats.Wins.Value >= 100 then -- continue from here
onlyjakep
(jakep)
February 25, 2022, 11:09am
5
for some reason the text wont change to it, im pretty sure its supposed to be a script
onlyjakep
(jakep)
February 25, 2022, 11:11am
7
still not working
game.Players.PlayerAdded:Connect(function(player)
while true do
wait(1)
if game.Players.LocalPlayer.leaderstats.Wins.Value >= 0 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 24 then
script.Parent.Text = "CURRENT DIVISION: ".. "PRO"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 48 then
script.Parent.Text = "CURRENT DIVISION: ".. "ELITE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 88 then
script.Parent.Text = "CURRENT DIVISION: ".. "MASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 125 then
script.Parent.Text = "CURRENT DIVISION: ".. "GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 250 then
script.Parent.Text = "CURRENT DIVISION: ".. "CHAMPION FINALS"
else
print("halal mode")
end
end
end)
onlyjakep
(jakep)
February 25, 2022, 11:11am
8
still not working
game.Players.PlayerAdded:Connect(function(player)
while true do
wait(1)
if game.Players.LocalPlayer.leaderstats.Wins.Value >= 0 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 24 then
script.Parent.Text = "CURRENT DIVISION: ".. "PRO"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 48 then
script.Parent.Text = "CURRENT DIVISION: ".. "ELITE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 88 then
script.Parent.Text = "CURRENT DIVISION: ".. "MASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 125 then
script.Parent.Text = "CURRENT DIVISION: ".. "GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 250 then
script.Parent.Text = "CURRENT DIVISION: ".. "CHAMPION FINALS"
else
print("halal mode")
end
end
end)
Put in local script
if game.Players.LocalPlayer.leaderstats.Wins.Value >= 0 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 24 then
script.Parent.Text = "CURRENT DIVISION: ".. "PRO"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 48 then
script.Parent.Text = "CURRENT DIVISION: ".. "ELITE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 88 then
script.Parent.Text = "CURRENT DIVISION: ".. "MASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 125 then
script.Parent.Text = "CURRENT DIVISION: ".. "GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 250 then
script.Parent.Text = "CURRENT DIVISION: ".. "CHAMPION FINALS"
else
print("halal mode")
end
daulric
(Ulric)
February 25, 2022, 11:12am
10
is it a billboard gui if yes then u need a server script.
btw i need to go to school
onlyjakep
(jakep)
February 25, 2022, 11:13am
11
its not working still its a normal textlabel
p_droXD
(Pedro)
February 25, 2022, 11:14am
12
This should work:
game.Players.PlayerAdded:Connect(function(player)
if player.leaderstats.Wins.Value > 0 and player.leaderstats.Wins.Value <= 23 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif player.leaderstats.Wins.Value >= 24 and player.leaderstats.Wins.Value <= 47 then
script.Parent.Text = "CURRENT DIVISION: ".. "PRO"
elseif player.leaderstats.Wins.Value >= 48 and player.leaderstats.Wins.Value <= 87 then
script.Parent.Text = "CURRENT DIVISION: ".. "ELITE"
elseif player.leaderstats.Wins.Value >= 88 and player.leaderstats.WIns.Value <= 124 then
script.Parent.Text = "CURRENT DIVISION: ".. "MASTER"
elseif player.leaderstats.Wins.Value >= 125 and player.leaderstats.Wins.Value <= 249 then
script.Parent.Text = "CURRENT DIVISION: ".. "GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 250 then
script.Parent.Text = "CURRENT DIVISION: ".. "CHAMPION FINALS"
else
print("halal mode") then
end
end)
onlyjakep
(jakep)
February 25, 2022, 11:15am
13
is it inside a script or localscript?
p_droXD
(Pedro)
February 25, 2022, 11:16am
14
I don’t know, I just fixed your script
onlyjakep
(jakep)
February 25, 2022, 11:18am
15
no you didnt, its not changing the text…
p_droXD
(Pedro)
February 25, 2022, 11:20am
16
Probably u can’t acces PlayerAdded function from a LocalScript. Try this then
while wait(2) do
if player.leaderstats.Wins.Value > 0 and player.leaderstats.Wins.Value <= 23 then
script.Parent.Text = "CURRENT DIVISION: ROOKIE"
elseif player.leaderstats.Wins.Value >= 24 and player.leaderstats.Wins.Value <= 47 then
script.Parent.Text = "CURRENT DIVISION: PRO"
elseif player.leaderstats.Wins.Value >= 48 and player.leaderstats.Wins.Value <= 87 then
script.Parent.Text = "CURRENT DIVISION: ELITE"
elseif player.leaderstats.Wins.Value >= 88 and player.leaderstats.WIns.Value <= 124 then
script.Parent.Text = "CURRENT DIVISION: MASTER"
elseif player.leaderstats.Wins.Value >= 125 and player.leaderstats.Wins.Value <= 249 then
script.Parent.Text = "CURRENT DIVISION: GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value > 250 then
script.Parent.Text = "CURRENT DIVISION: CHAMPION FINALS"
else
print("halal mode") then
end
end
Xapelize
(Xap)
February 25, 2022, 11:27am
17
The problem was at the elseif.
local TestNumber = 1
if TestNumber >= 0 then
print("TestNumber is larger than 0!")
elseif TestNumber >= 1 then
print("TestNumber is larger than 1!")
end
Guess what it did? The output printed “TestNumber is larger than 0!”, but not “TestNumber is larger than 1!”? That’s because it checks on the first if statement, and if it’s valid, it skips to the end. What you should be doing is:
local TestNumber = 1
if TestNumber >= 0 then
print("TestNumber is larger than 0!")
end
if TestNumber >= 1 then
print("TestNumber is larger than 1!")
end
Printed “TestNumber is over 0!” and “TestNumber is over 1!”. You should not be doing elseif to reduce lines though. That’s not a shortcut, that’s a different mechanic that the developer hub didn’t cover well. Hope this helped!
NateOTB
(Kocch_i)
February 25, 2022, 11:28am
18
Mind providing a screenshot of where the script is.
onlyjakep
(jakep)
February 25, 2022, 11:28am
19
thanks, thats also another way to solve it, will take that in mind.
NateOTB
(Kocch_i)
February 25, 2022, 11:35am
20
if the script is a descendant of a textlabel then
local player = game:GetService("Players")
local LocalPlayer = player.LocalPlayer
local leaderstats = LocalPlayer:WaitForChild("leaderstats")
local Wins = leaderstats:WaitForChild("Wins")
print(leaderstats, wins) -- checks if these exists
local function division(wins)
if wins.Value > 0 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif wins.Value > 24 then
script.Parent.Text == "CURRENT DIVISION: ".. "PRO"
elseif wins.Value > 48 then
script.Parent.Text == "CURRENT DIVISION: ".. "ELITE"
elseif wins.Value > 88 then
script.Parent.Text == "CURRENT DIVISION: ".. "MASTER"
elseif wins.Value > 125 then
script.Parent.Text == "CURRENT DIVISION: ".. "GRANDMASTER"
elseif wins.Value > 250 then
script.Parent.Text == "CURRENT DIVISION: ".. "CHAMPION FINALS"
else
print("halal mode")
end
end
divisions(Wins.Value)
Wins.Changed:connect(function(value)
divisions(value)
end
It is just a common mistake. Don’t forget: “>=” means equal or greater than so you were checking in the code from the first post if player’s wins were equal or greater than 0 instead of checking if it is less than the next division’s wins.
if game.Players.LocalPlayer.leaderstats.Wins.Value < 24 then
script.Parent.Text = "CURRENT DIVISION: ".. "ROOKIE"
elseif
if game.Players.LocalPlayer.leaderstats.Wins.Value < 48 then
script.Parent.Text == "CURRENT DIVISION: ".. "PRO"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value < 88 then
script.Parent.Text == "CURRENT DIVISION: ".. "ELITE"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value < 125 then
script.Parent.Text == "CURRENT DIVISION: ".. "MASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value < 250 then
script.Parent.Text == "CURRENT DIVISION: ".. "GRANDMASTER"
elseif game.Players.LocalPlayer.leaderstats.Wins.Value >= 250 then
script.Parent.Text == "CURRENT DIVISION: ".. "CHAMPION FINALS"
end
--else
--print("halal mode") then
end
Also yes, when the player joins they can’t recieve the PlayerAdded signal from server.