Ezz you would go into the property’s of the scrolling frame and there is one in there that lets you change how far it scrolls I don’t remember the exact name for it tho
For anybody who seems to have issues with this line: *local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))* and have the error "Players:GetNameFromUserId() failed because HTTP 404 (Not Found)" Please add this if statement above that line: *if tonumber(data.key) > 0 then* and then put an *end* under the two ends that are under the 'break'.
For everyone getting an error from the print(errorMessage) and it says "serverscriptservice.leaderboardshow:24: attempt to perform arithmetic (mul) on number and table - server - leaderboardshow:30", make sure that in "newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)" before game.Workspace.GlobalLeaderboard etc. you have a #. I hope you find this helpful!
Really good video, however, ide recommend that when you're getting sorted async you do (false,5,9.22e+17) to prevent exploiters, as it won't show anything above 9.22e+17 (922 quadrillion)
Great video. Very quick and with decent explanation, as well as getting it done. The typo part was funny though, I noticed it and had to wait while you were freaking. Thanks for the help!
Thank you so much! This is exactly what I needed! At least you only knocked over your leaderboard. I made an obby and forgot to anchor all those parts... it was a very difficult obby xD
@@epicunique1016 yeah, save a variable that increases when someone buys an article of clothing and then call the clothes variable that is saved instead of wins. Basically the same thing he just showed us.
Can you please make a voting system where a GUI is displayed for everyone and when you click an option that button gets highlighted and you know just like map voting systems.
Omg thank you so much it worked, I just started to make a game and conveniently you made the exact thing I needed just a few hours before, you got a new sub :)
It would probably have the same basic concept, but your “Wins” would be called something else, like “R$,” and you’d change that value depending on how much the player donates. :)
I got a few questions. How to kick someone from the leaderboard or reset their points/wins? Mind making a video on how to protect your events from exploiters firing the server?
It’s actually pretty simple by using Local PlayerChar = Game.Players.NameOfPlayer.Character:Clone PlayerChar.Parent = Workspace PlayerChar:MoveTo( Pedestal position) Something like this, and sorry for any errors I’m new to scripting
i made a modulescript which is called each time a score has changed. I put all the scores and players in to a table and use table.sort command. it makes a top 10 leaderboard. it floats my boat and does what i want local leaderboard = {} leaderboard.sort = function()
local scores = {} -- get all scores
for i, v in pairs(game.Players:GetChildren()) do scores[#scores+1] = v.PlayerVariables.Score.Value.."-"..v.Name end
-- clear leaderboard
for i, v in pairs(game.Workspace.Leaderboard.LeaderboardGUI.Holder:GetChildren()) do v:Destroy() end
table.sort(scores) local cnt = 1 local pos = 0 local target = 0 if #scores > 10 then target = #scores - 10 else target = 1 end
for a = #scores,target,-1 do local newrank = game.ReplicatedStorage.LeaderboardFrame:Clone() newrank.Rank.Text = cnt local temp = string.split(scores[a],"-") newrank.PlayerName.Text = temp[2] newrank.Score.Text = temp[1] newrank.Position = UDim2.new(0,0,pos,0) newrank.Parent = game.Workspace.Leaderboard.LeaderboardGUI.Holder pos = pos + 0.09 cnt = cnt + 1 end end return leaderboard
@@RileyHighBerg hello, i’m not the original commenter but i’d recommend following a beginner series. devking has one here on his channel, and after you’re done with it, you can move on to the advanced. make sure you follow along so that you can learn, don’t just watch the videos
@@kthuludev thank you for replying! I will watch devking beginner coding videos! Before finding your comment I learned some beginner codes which was the language python is it the right language for Roblox?
I wanna make a leader board where i can count the time (in minutes) for the people who has played. For example , if someone has played... 3500 min. it will show that everytime they join and it will keep going up for every min they spend in my game.
The only issue I have with tutorials this complex is I don't know enough to fix it when it breaks. Mine didn't work and I had no idea what to do so had to delete it.
That is a lot of code but I am so glad that it worked. The only thing I would want on top of the leaderboard would be a scroll feature to look at more players than the size of the part.
@@notsmartnotsmart8636 Oh sorry but you prob dont even know metatables now im off i have better stuff to do like using the convex hull algorithim in studio which is something your tiny brain will never accomplish
Hey guys, if you are wondering if it doesn't work, you need to go to settings -> options -> and turn Studio access to API services on. There you go! (It's only if you wrote the script right)
3rdOnion 3rdOnion I think he mentioned it in the video, but in case you missed it. Change: if Wins and isonLeaderboard == false then. To: if Wins > 0 and isonLeaderboard == false then.
@@bhevrage well, it is actually pretty simple. First of all, if you don’t already have your explorer open, then open it up, then you gotta select all of the labels you want to copy by holding down CTRL and clicking on each of them. Then of course, after you selected them all, do CTRL+C. That should copy it down. Then, you wanna go to the parent you want to paste the labels into, for example in the video the parent was the frame. Left click on it and find the option that says “paste”. Click on it and it should copy the labels to that frame. If there was anything wrong or if I’m wrong, please do correct me!
for some reason the gui dosnt pop up on the leaderboard, does anyone know how to fix this? I get no errors and i wrote the code exactly like he did in the video.
It's telling me this, "Player is not a valid member of Frame "LeaderboardFrame" - Server - LeaderboardHandler:32" and i have no idea what to do. can anyone help me?
It isnt saying any errors in the output, and it's saving. But nothing pops up on the leaderboard. I can't figure it out, if anyone knows the answer please let me know! Edit: I found out the Info in the Holder is not being cloned into it. I also did some print(1) tests and found out that it is only making it to line 8, wich is the line that says: for, rank Data in ipairs(CashPage) do
you should redo frame creating system. and i bet you have data.Key instead of data.key (lowercase it) well for you here is my code but you should edit it like changing path to object names and etc. local DataStoreService = game:GetService('DataStoreService') local WinsLeaderboard = DataStoreService:GetOrderedDataStore('WinsLeaderboard41') local function UpdateLeaderboard() local success,errorMessage = pcall(function() local Data = WinsLeaderboard:GetSortedAsync(false,5) local WinsPage = Data:GetCurrentPage() for Rank, data in ipairs(WinsPage) do local UserName = game.Players:GetNameFromUserIdAsync(tonumber(data.key)) local Name = UserName local Wins = data.Value local plr_num = 1 for _,player in pairs(game.Players:GetPlayers()) do local newlb = game.ReplicatedStorage.leaderboard_frame:Clone() newlb.Parent = workspace.leaderboard.SurfaceGui.ScrollingFrame newlb.Name = tostring(plr_num) newlb.Rank.Text ='#'..tostring(plr_num) newlb.Player.Text = player.DisplayName newlb.Wins.Text = tostring(player:WaitForChild('leaderstats'):WaitForChild('Wins').Value) plr_num += 1 end
end end) if not success then print(errorMessage) end end while true do for _, Player in pairs(game.Players:GetPlayers()) do WinsLeaderboard:SetAsync(Player.UserId,Player.leaderstats.Wins.Value) end for _, frame in pairs(game.Workspace.leaderboard.SurfaceGui.ScrollingFrame:GetChildren()) do if frame:IsA('Frame') then frame:Destroy() end end
I was about to comment that it doesnt work because an error message popped up saying, "Player is not a valid member or frame, 'Leaderboardframe'" but it was because I changed the text to "Name" instead of "Player" Anyways thank you so much! this is what I needed for my game!
@@eighthgosling1455 bro me toooo but IM SO CLOSE TO FINDE OUT WHAT IS WRONG AND WHEN I REPAIR THIS I TOLD U I KNOW THAT WAS 2M AGO BUT STILL I WILL HELP XDD
You can use this code local part = script.Parent local canGet = true local function onTouch(otherPart) local humanoid = otherPart.Parent:FindFirstChild('Humanoid') if humanoid then local player = game.Players:FindFirstChild(otherPart.Parent.Name) if player and canGet then canGet = false player.leaderstats.Wins.Value = player.leaderstats.Wins.Value + 1 wait(180) canGet = true end end end part.Touched:Connect(onTouch)
Very good video, although I am having one trouble. It says "Argument 1 missing or nil - Server" whenever it tries to execute the print (errorMessage) line. Any recommendations to fix this?
I am looking for a video about how to add a board that automatically adds the players names and picture when they join the game teleporter, like if you’ve played flicker... I’m not sure how to explain it or what it’s called but if you know what I am talking about plz make a video!! 💙💙💙
For all of you guys saying it is not working, make sure to check many times to look for mistakes and if you want to, make the wins part anything you want but try to make the parts that need to match- match. Edit: I spent 22 mins on this?! Tbh it was worth it tho
@@eternxldarkness9575 for _, player in pairs(game.Players:GetPlayers()) do WinsLeaderboard:SetAsync(player.UserId, player.leaderstats.Wins.Value) end change Wins.Value to yourStatName.Value
this error occurs if your data saves contain more than just the user id, to fix this you will unfortunately need to delete all of the saves that are saved with text
An example of how not to do it would be if you saved your data like this: WinsDataStore:SetAsync(player.UserId..”-wins”, player.Wins.Value), instead save it like this: WinsDataStore:SetAsync(player.UserId, player.Wins.Value) Hope this helps :D
That error happens if your database key is something other than just the player username- Ex. "Player_2373147" instead of just "2373147" SOLUTION: DON'T: delete all of the saves. DO: replace the line with "local userName = game.Players:GetNameFromUserIdAsync(tonumber((data.key):match("%d+")))" This extracts just the ID.
Me: Trying to do this as fast as I can, looks through the comments, DANG IT! NOBODY POSTED THE SCRIPT!! Me after 5 seconds of the video: *looks up "Global Leaderboard" in the toolbox*
this is my script when i copied it, did i do it right local DataStoreService = game:GetService ("DataStoreService") local WinsLeaderboard = DataStoreService:GetOrderedDataStore("WinsLeaderBoard") local function updateLeaderboard() local success, errorMessage = pcall(function() local Data = WinsLeaderboard:GetSortedAsync(false, 5) local Winspage - DataGetCurrentPage() for rank, data in ipairs(Winspage) do local userName - game.Player:GetNameFromUserIdAsync(tonumber(data.key) local Name - userName local Wins = data.value local isOnLeaderboard = false for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do if v.Player.text -- Name then isOnLeaderboard - true break
end end
if Wins and isOnLeaderboard -- false then local newLbFrame = game.ReplicatedStorage:WaitForChild("Leaderboard Frame"):Clone() newLbFrame.Player.Text - Name newLbFrame.Wins.Text = Wins newLbFrame.Rank.Text = "#"..Rank newLbFrane.Position - UDim.new(0, 0, newLbFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder: GetChildren ()), 0) newLbFrame.Parent = game.Workspace.GlobalLeaderBoard.LeaderboardGUI.Holder end end end) if not success then print(errorMessage) end end while true do
for _, Player in pairs (game.Players:GetPlayers()) do WinsLeaderboard:SetAsync(player.UserId , player/leaderstats.Wins.Value) end for _, frame in pairs(game.Workspace.GlobalLeaderBoard.LeaderboardGUI.Holder:GetChildren.()) do frame:Destroy() end end
not sure if anyone will see this now but it isnt an error but when i actually go into a server of the game not in studio the log says "Player is not a valid member of Frame "Workspace.ALL BIG TV PARTS.GlobalLeaderBoard.Completed.leaderboardgui.holder.Leaderboard Frame" when I dont even know where that part of code is. Can anyone help me out if you see this? Bc ive looked thru the code like 50 times over and what this 'error' does is only let 1 person show up on the leaderboard at a time.
Great work however can you make a tutorial please on a script for two leader boards and how to update them. I am having difficulty in running this script for 2 leader boards in the one game that use different stats. Thanx
I had this issue too until I realized that you just have to duplicate the Rank, Player, and Wins to the LeaderboardFrame in ReplicatedStorage and It should work fine
Why does it say: GlobalLeaderboard is not a valid member of Workspace "Workspace" - Server - LeaderboardHandler:42 Did I do something wrong? there's no typo there's no mistakes too! Please help me out :(
r u sure there's no typo? the script check if there's something called "GlobalLeaderBoard" inside of workspace, if there's no "GlobalLeaderBoard" it will send error
I saw the same thing and when I went to check my workspace, it turns out I named it “Global Leaderboard” (with a space) instead of “ GlobalLeaderboard” (without a space)
It's the same thing just put a value in the player's leaderstats that adds a visit every time they join the game. Use that value instead of wins on the global leaderboard.
@@EpicVideoClips101 a few. - avoid using a while loop for saving - check for limits - check if the saving was successful - reattempt if something goes wrong - keep a cache of player data in the server and not in the player so even if the player leaves you can save data efficiently And so on
@@rodrigosimoes7103 is the while loop just to save? (ik there is a part where it updates the leaderboard but I'm not including that). If its only for saving the data (not including updating lb again) then it would be easier using datastore in the leaderstats script. Sorry for the confusion if I did any
him: I'm not gonna waste to much time
me: *cries in 18 more minutes*
What the fu
@Mr. Creeper Man you have slow net kido or you just dont like watching it HD Mode ?
a
*too much time
This is what I asked for like 2 episodes ago thanks so much
Ezz you would go into the property’s of the scrolling frame and there is one in there that lets you change how far it scrolls I don’t remember the exact name for it tho
Ezz if you are still wanting it to scroll you could just use a regular frame and just space it correctly tho
For anybody who seems to have issues with this line:
*local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))*
and have the error "Players:GetNameFromUserId() failed because HTTP 404 (Not Found)"
Please add this if statement above that line:
*if tonumber(data.key) > 0 then*
and then put an *end* under the two ends that are under the 'break'.
if not tonumber(data.key) > 0 then return end
@@mile.9768 if not {tonumber(data.key)} > 0 then return end
Him: Scripting*
Me slowly following along: Why does he sound like deppressed chris from mr beast?
Idk
@@anoop_brar lol
nooo now I can't unhear this
@@classique_ ikr
he sounds like kreekcraft lol
For everyone getting an error from the print(errorMessage) and it says "serverscriptservice.leaderboardshow:24: attempt to perform arithmetic (mul) on number and table - server - leaderboardshow:30", make sure that in "newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)" before game.Workspace.GlobalLeaderboard etc. you have a #. I hope you find this helpful!
YOURE A LIFE SAVER THANK YOU SO MUCH
DUDE YOURE LITERALLY AMAZING THANK YOU
@@hii1317 No problem!
Oh my god, tysm! You’re a godsend :D
Thank you so much dude, I was having so much trouble.
Really good video, however, ide recommend that when you're getting sorted async you do (false,5,9.22e+17) to prevent exploiters, as it won't show anything above 9.22e+17 (922 quadrillion)
Nobody wants to see that many wins on a leaderboard so just make it math.huge
9.22e+18*
@@eazy7242 math.huge is bigger than 9.22e+18 and nobody wants to see 1.79e309 wins either
you could make the number much lower realistically
i would rather it show the exploiter on the leaderboard cuz then i'd know that that guy exploited and i can ban him
Great video. Very quick and with decent explanation, as well as getting it done. The typo part was funny though, I noticed it and had to wait while you were freaking. Thanks for the help!
yes very quick
@@verified0506 yeah 22 minutes so fast
@@Fo1hr that is pretty quick if you need a tutorial for something like this
@@seadrown6252 yea no thats not quick at all more like half of the video is just him creating the leaderboard design or yapping
Thank you so much! This is exactly what I needed!
At least you only knocked over your leaderboard. I made an obby and forgot to anchor all those parts... it was a very difficult obby xD
James Steinbrecher do u know how to do this but when u are trying to make a leaderboard for who has bought the most clothes
Epic Unique101 just replace the wins with clothes and go to the script and replace everything that says Wins with Clothes.
@@epicunique1016 yeah, save a variable that increases when someone buys an article of clothing and then call the clothes variable that is saved instead of wins. Basically the same thing he just showed us.
@@epicunique1016 please copy the script
Can you please make a voting system where a GUI is displayed for everyone and when you click an option that button gets highlighted and you know just like map voting systems.
Nevermind I figured it out by myself
@@sd1757 He did do a video on voting with GUI on parts anyway for those interested.
Ez
just use math.max and compare it with stuff
Legend man.... LB's were doing my head in but now it works!!!!! Thanks to you. Now for data store.
HOW DO YOU ALWAYS KNOW EXACTLY WHAT IM LOOKING FOR
IKR!
same ikr
Ya
finally a tut that not using free models leaderboard, not watched yet, but hopefully this one paid off!
Omg thank you so much it worked, I just started to make a game and conveniently you made the exact thing I needed just a few hours before, you got a new sub :)
20:00 was like at a pantomime screaming he’s behind you. You spelled it position and I was screaming away like omfg it’s there lol
U put more time on designs than scripting ;-;
@Francis Dagami well he's right... He spent like the first 8 minutes just setting it up.
facts
I mean, there was actually barely any design he put it.
In fact there's more scripting than designing in there.
FAX
welp, good to know that I destroyed my game trying to make this.
Same lol
just revert the version lol
then u delete it THINK WITH YOUR BRAIN YOU HAVE ONE
Love this video!!
Can you make a donation system or donation leaderboard?
It would probably have the same basic concept, but your “Wins” would be called something else, like “R$,” and you’d change that value depending on how much the player donates. :)
Theres a model for it
I used it in my game
@@TOAST3D ik I answered 4 months later, but if u just use models, u totally didn't put effort in the game
@@Not_Flood 1 model isnt using all models dumbass, why would i script it all if theres already a pre made one
The first "For Loop" dont work, the Output are Clean
@@eazy7242 He is brazilian so his english is not perfect like me but I am Colombian.
Wow, now I can use it in my game!
I got a few questions.
How to kick someone from the leaderboard or reset their points/wins?
Mind making a video on how to protect your events from exploiters firing the server?
you can install a plugin called leaderboard data and if notice someone up there that u think is cheating u can reset their stats
3:10 video mark for me so i can finish this later when i feel like it cuz its too complicated and he does too much
13:56 gotta go bed now
wake up
gotta go to school. -
This is going to be very useful in my opinion. Very good video!
Could you make a tutorial on how to fetch the character's avatar to show on a pedestal?
It’s actually pretty simple by using
Local PlayerChar = Game.Players.NameOfPlayer.Character:Clone
PlayerChar.Parent = Workspace
PlayerChar:MoveTo( Pedestal position)
Something like this, and sorry for any errors I’m new to scripting
Just use the tool "Load Character" by AlreadyPro. It's free and easier than writing a script.
@@elitegamingandmore3723 Instead of MoveTo i suggest moving the primarypart for this type of situation
And since its a character by default the primarypart is the humanoidrootpart
@@bhevrage he mean the live-updating character
Dude you make awesome Tutorials
i made a modulescript which is called each time a score has changed. I put all the scores and players in to a table and use table.sort command. it makes a top 10 leaderboard. it floats my boat and does what i want
local leaderboard = {}
leaderboard.sort = function()
local scores = {}
-- get all scores
for i, v in pairs(game.Players:GetChildren()) do
scores[#scores+1] = v.PlayerVariables.Score.Value.."-"..v.Name
end
-- clear leaderboard
for i, v in pairs(game.Workspace.Leaderboard.LeaderboardGUI.Holder:GetChildren()) do
v:Destroy()
end
table.sort(scores)
local cnt = 1
local pos = 0
local target = 0
if #scores > 10 then
target = #scores - 10
else
target = 1
end
for a = #scores,target,-1 do
local newrank = game.ReplicatedStorage.LeaderboardFrame:Clone()
newrank.Rank.Text = cnt
local temp = string.split(scores[a],"-")
newrank.PlayerName.Text = temp[2]
newrank.Score.Text = temp[1]
newrank.Position = UDim2.new(0,0,pos,0)
newrank.Parent = game.Workspace.Leaderboard.LeaderboardGUI.Holder
pos = pos + 0.09
cnt = cnt + 1
end
end
return leaderboard
how did u learn scripting and coding? Because I want to learn the basics so I can start my game
@@RileyHighBerg hello, i’m not the original commenter but i’d recommend following a beginner series. devking has one here on his channel, and after you’re done with it, you can move on to the advanced. make sure you follow along so that you can learn, don’t just watch the videos
@@kthuludev thank you for replying! I will watch devking beginner coding videos! Before finding your comment I learned some beginner codes which was the language python is it the right language for Roblox?
Thanks for the tutorial, also please could you make a tutorial on how to animate and script the animation as it will be very useful. Thanks again :)
14:22 need to go to bed see ya hope this wokrs tbh
I wanna make a leader board where i can count the time (in minutes) for the people who has played. For example , if someone has played... 3500 min. it will show that everytime they join and it will keep going up for every min they spend in my game.
need this as well, someone tell me when the find an answer
@@genocidist2602 LMAOOo ty tho LOL
@@genocidist2602 THİS İS COMEDY GOLD LMAOOO
The only issue I have with tutorials this complex is I don't know enough to fix it when it breaks. Mine didn't work and I had no idea what to do so had to delete it.
same
He sounds like Dennis daily
Ye lol
That is a lot of code but I am so glad that it worked. The only thing I would want on top of the leaderboard would be a scroll feature to look at more players than the size of the part.
im pretty sure you can add a ScrollingFrame and that fixes it.
@@meowuni-949 i tried it theres a big gap
i typed all the code and in the end it didn't work ;-;
not even an error in the console to help me out
edit: I had to change the names of my labels
Great Tutorial. It work with one Player. Of i start in Server with 2 Players i See only one player on the Board.
0:34
*Forever Alone*
this is Roblox Studio how can you have players then?
@@bdidk235
Can't you take a joke?
PS: *r/woooooosh*
bdidhdk imagine not knowing what a joke is
Wow tap in olden days
Please, Next Video: **EGG HACTHING SYSTEM**
Thats easy lol
@@notsmartnotsmart8636 Oh sorry but you prob dont even know metatables now im off i have better stuff to do like using the convex hull algorithim in studio which is something your tiny brain will never accomplish
@@BallChewer16 He probably has a bigger brain than you.
LOL NO HE ISNT HE PROB USES SETAYNC GARBAGE
@@BallChewer16 Your just a kid im also a kid :) but I know when people have a bigger brain than other people
thank you for helping me with my game!
Hey guys, if you are wondering if it doesn't work, you need to go to settings -> options -> and turn Studio access to API services on. There you go! (It's only if you wrote the script right)
It worked but it didn't show the highest wins it just showed someone that had 0 wins :C. You do know how to fix this right?
3rdOnion 3rdOnion I think he mentioned it in the video, but in case you missed it. Change: if Wins and isonLeaderboard == false then. To: if Wins > 0 and isonLeaderboard == false then.
You seem like you know what you're doing, how do I copy and paste the labels like at 6:58
@@bhevrage well, it is actually pretty simple. First of all, if you don’t already have your explorer open, then open it up, then you gotta select all of the labels you want to copy by holding down CTRL and clicking on each of them. Then of course, after you selected them all, do CTRL+C. That should copy it down. Then, you wanna go to the parent you want to paste the labels into, for example in the video the parent was the frame. Left click on it and find the option that says “paste”. Click on it and it should copy the labels to that frame. If there was anything wrong or if I’m wrong, please do correct me!
@@soccerbus26 Thanks, but I figured it out. I highlighted all the labels I needed, right clicked on the frame and just clicked paste
Thank you so much, this content helps me!!
What if you want to save 2 stats? For example wins and deaths?
for some reason the gui dosnt pop up on the leaderboard, does anyone know how to fix this? I get no errors and i wrote the code exactly like he did in the video.
Same
Same here, I think the code is outdated
same
It's telling me this, "Player is not a valid member of Frame "LeaderboardFrame" - Server - LeaderboardHandler:32" and i have no idea what to do. can anyone help me?
Is your TextLabel named Player under the LeaderboardFrame? Should fix the issue
Him: this isn't tooooooooooo hard
Me: cries in not being able to copy and paste
ikr
copying and pasting is so much easier
7:39 hey this is a personal mark for me! :) I’ll do the rest tomorrow
youtube saves where you left off
@@ask343 not always, sometimes it breaks
@@ask343 unless you pause your watch history
@@TheFinalCurtains who in their right mind does that
9:11 just gonna pick up where I left off tomorrow morning
It isnt saying any errors in the output, and it's saving. But nothing pops up on the leaderboard. I can't figure it out, if anyone knows the answer please let me know!
Edit: I found out the Info in the Holder is not being cloned into it. I also did some print(1) tests and found out that it is only making it to line 8, wich is the line that says: for, rank Data in ipairs(CashPage) do
same
@thisisausername i have the same problem. what do you do to fix it
Are you getting the error message:
"Argument 1 missing or nil"
In the output?
@@DasKairo Ya how to fix it?
you should redo frame creating system. and i bet you have data.Key instead of data.key (lowercase it)
well for you here is my code but you should edit it like changing path to object names and etc.
local DataStoreService = game:GetService('DataStoreService')
local WinsLeaderboard = DataStoreService:GetOrderedDataStore('WinsLeaderboard41')
local function UpdateLeaderboard()
local success,errorMessage = pcall(function()
local Data = WinsLeaderboard:GetSortedAsync(false,5)
local WinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(WinsPage) do
local UserName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = UserName
local Wins = data.Value
local plr_num = 1
for _,player in pairs(game.Players:GetPlayers()) do
local newlb = game.ReplicatedStorage.leaderboard_frame:Clone()
newlb.Parent = workspace.leaderboard.SurfaceGui.ScrollingFrame
newlb.Name = tostring(plr_num)
newlb.Rank.Text ='#'..tostring(plr_num)
newlb.Player.Text = player.DisplayName
newlb.Wins.Text = tostring(player:WaitForChild('leaderstats'):WaitForChild('Wins').Value)
plr_num += 1
end
end
end)
if not success then
print(errorMessage)
end
end
while true do
for _, Player in pairs(game.Players:GetPlayers()) do
WinsLeaderboard:SetAsync(Player.UserId,Player.leaderstats.Wins.Value)
end
for _, frame in pairs(game.Workspace.leaderboard.SurfaceGui.ScrollingFrame:GetChildren()) do
if frame:IsA('Frame') then
frame:Destroy()
end
end
UpdateLeaderboard()
print('updated')
wait(10)
end
I was about to comment that it doesnt work because an error message popped up saying, "Player is not a valid member or frame, 'Leaderboardframe'" but it was because I changed the text to "Name" instead of "Player" Anyways thank you so much! this is what I needed for my game!
Did it work
Cause it works but it's not entering the second loop or like it's not getting cloned into holder in workspace
Thanks for tutorial! I make a time leaderboard!!! (With autosave)
Could you send me the script for it?
Him: There's nothing else on here cus.... I dont have anybody to come here.
me: O_O
Damn hes lonely
LOL right
What should I do if I want another section called cash on the leaderboard
Guitar Sidadi pretty sure it’s the exact same thing
Yeah just name of the currency to the one you want to use
@@erick599 I did but it just added a wins section
edit:nvm i just deleted leaderstats script
A.S.K343 Did you make another leaderboard with wins section?
@@erick599 I did so i removed the leaderstats script so it stopped making a new section
*cries* easy than i thought..i didnt even know how to make a gui -cries in pain-
I think the script outdated anyway
no one:
me, a pro scripter who can code almost everything
still me: Ctrl + C, Ctrl + V
lol
No im a pro bc i use Ctrl + A, Ctrl + C, Ctrl + V lol 😂
@@Purplesouley101 i use double click and click + drag so we are pro :))
Pretty same just copy some scripts
hippity hoppity your code is now my property
Hey, @TheDevKing I love your videos! Can you teach me how to use Social Service? (How to make a friend invite system)
Bruh U sound like Khan from the academy....
ikr
thanks so much!
no error output is coming up for me however it still isnt working either. the player name, number of wins and rank isnt showing up for me.
Hey, I'm having the same thing. I know it's been over a year but have you found a solution?
@@eighthgosling1455 bro me toooo but IM SO CLOSE TO FINDE OUT WHAT IS WRONG AND WHEN I REPAIR THIS I TOLD U I KNOW THAT WAS 2M AGO BUT STILL I WILL HELP XDD
have you?@@eighthgosling1455
someone plz and plz help me so when i did it it did not showed my wins was only 0 but i had 100 and also it showed my name and rank but not wins
helllpp
plzzz
How do you get the wins though. I'm confused on that part like what do you do in order for a player to get a win.
thats a different code
You can use this code
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canGet then
canGet = false
player.leaderstats.Wins.Value = player.leaderstats.Wins.Value + 1
wait(180)
canGet = true
end
end
end
part.Touched:Connect(onTouch)
LOL i just looked up a random tutorial and it's yours! I watch shark tank. lel
Oh. Well thanks for telling me it doesn't save at the VERY END, i just spent a whole hour for literally nothing.
Just make it save by watching a video
He said it wouldn't save at the start. He also said he wouldn't do a data storage. Watch his data storage video. It's simple enough.
bruh he cant do everything for you Look up datastores follow a tutorial and boom 30 mins later it saves
It saves for me??
@@joel2764 not even 30 min just 5
Nice Video dude! You deserve a follow and a like!
Hey, If
data.key
and
data.value
aren't wokring, use
WinsPage[rank].key
and
WinsPage[rank].value
Hope this helps!
at 9.223e+18 it's doesn't work, who know why plz ?
Same problem here man.
it actually makes sense
This is the maximum value of the Double data type in Lua
it can't go any further
@@kirillfedorenko5325 What should i do then ? I'm still having the issue and don't know what to do...
@@jeanpierre6120 i guess you can't do anything with this
when you call someone a big fat noob, he becomes big and stomps on you
i now already spent 2 hours trying to find out why it is not updating my wins (for me clicks)
same
this is what i was looking for thanks man ive been trying to find this for a while didnt know how to word it in the search
Very good video, although I am having one trouble. It says "Argument 1 missing or nil - Server" whenever it tries to execute the print (errorMessage) line. Any recommendations to fix this?
Can I see the code on your script?
So satisfying
Players:GetNameFromUserId() failed because HTTP 404 (NotFound)
Yeah I got the same thing..
I know why i have error. Because if you test game with player 1 and player 2 it local player then you got error
Did you activate HTTP requests? Home -> Game Settings -> Options -> Allow HTTP Requests
Hello, love the video, really helpful! I was curious, is there any way to track NPC leaderstats and save those like you would any normal player?
Why do u have to make this the day after i figure this out lol!
I am looking for a video about how to add a board that automatically adds the players names and picture when they join the game teleporter, like if you’ve played flicker... I’m not sure how to explain it or what it’s called but if you know what I am talking about plz make a video!! 💙💙💙
19:50 it always happens to me XD
7:43 shubashribshervish lol no offence!!!! please dont send hate :)
For all of you guys saying it is not working, make sure to check many times to look for mistakes and if you want to, make the wins part anything you want but try to make the parts that need to match- match.
Edit: I spent 22 mins on this?! Tbh it was worth it tho
I spent 5 hours trying to fix it still havent
Nice video keep up the GOOD WORK ;D
What if I already have a value and I want that to be on the leaderboard?
you learn how to change values...
@@rgby1367 But how though?
@@eternxldarkness9575 for _, player in pairs(game.Players:GetPlayers()) do
WinsLeaderboard:SetAsync(player.UserId, player.leaderstats.Wins.Value)
end
change Wins.Value to yourStatName.Value
WAIT YOU'RE TAP? I WATCH YOUR BOOGA VIDS
edit: ive noticed your voice and i thought somethign was weird
Flamingo Somehow what do u mean tap he is TapGameplay!?!
@@SpyrosYT TapWater
anyone else getting the error: "Argument 1 missing or nil" on the line "local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))"?
I get an Error Message: GetCurrencyPage is not a valid member of DataStorePages "Instance" :/
ye
this error occurs if your data saves contain more than just the user id, to fix this you will unfortunately need to delete all of the saves that are saved with text
An example of how not to do it would be if you saved your data like this: WinsDataStore:SetAsync(player.UserId..”-wins”, player.Wins.Value), instead save it like this: WinsDataStore:SetAsync(player.UserId, player.Wins.Value)
Hope this helps :D
That error happens if your database key is something other than just the player username- Ex. "Player_2373147" instead of just "2373147"
SOLUTION:
DON'T: delete all of the saves.
DO: replace the line with "local userName = game.Players:GetNameFromUserIdAsync(tonumber((data.key):match("%d+")))" This extracts just the ID.
i wish i could copy n paste (also im a big fan)
Me confident in the beginning thinking I can do it.... it doesn’t save 👁👄👁💔
I can give u the code that saves since he did not make a DataStore lol
@@rusuovidiu6255 gimme
Me: Trying to do this as fast as I can, looks through the comments, DANG IT! NOBODY POSTED THE SCRIPT!!
Me after 5 seconds of the video: *looks up "Global Leaderboard" in the toolbox*
Lmao
Did it work?
Can you make a local server leaderboard please, I can’t figure out how to make it
just get the players using game.Players:GetPlayers() and make a code that detects whos the highest
Slow down, and lay off the coffee lol
exactly
GUN TUTORIAL EEEEEEEEE!
YOU SOUND LIKE TAP WATER XD
"its actually pretty simple"
Well it's easy if you learn about it.
Kinda like literally every other action
him:
me:
this is my script when i copied it, did i do it right
local DataStoreService = game:GetService ("DataStoreService")
local WinsLeaderboard = DataStoreService:GetOrderedDataStore("WinsLeaderBoard")
local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = WinsLeaderboard:GetSortedAsync(false, 5)
local Winspage - DataGetCurrentPage()
for rank, data in ipairs(Winspage) do
local userName - game.Player:GetNameFromUserIdAsync(tonumber(data.key)
local Name - userName
local Wins = data.value
local isOnLeaderboard = false
for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
if v.Player.text -- Name then
isOnLeaderboard - true
break
end
end
if Wins and isOnLeaderboard -- false then
local newLbFrame = game.ReplicatedStorage:WaitForChild("Leaderboard Frame"):Clone()
newLbFrame.Player.Text - Name
newLbFrame.Wins.Text = Wins
newLbFrame.Rank.Text = "#"..Rank
newLbFrane.Position - UDim.new(0, 0, newLbFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder: GetChildren ()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderBoard.LeaderboardGUI.Holder
end
end
end)
if not success then
print(errorMessage)
end
end
while true do
for _, Player in pairs (game.Players:GetPlayers()) do
WinsLeaderboard:SetAsync(player.UserId , player/leaderstats.Wins.Value)
end
for _, frame in pairs(game.Workspace.GlobalLeaderBoard.LeaderboardGUI.Holder:GetChildren.()) do
frame:Destroy()
end
end
updateLeaderboard()
print("Updated")
wait(60)
end
not sure if anyone will see this now but it isnt an error but when i actually go into a server of the game not in studio the log says "Player is not a valid member of Frame "Workspace.ALL BIG TV PARTS.GlobalLeaderBoard.Completed.leaderboardgui.holder.Leaderboard Frame" when I dont even know where that part of code is. Can anyone help me out if you see this? Bc ive looked thru the code like 50 times over and what this 'error' does is only let 1 person show up on the leaderboard at a time.
6:15 starts scripting
Thx
Great work however can you make a tutorial please on a script for two leader boards and how to update them. I am having difficulty in running this script for 2 leader boards in the one game that use different stats. Thanx
Anyone got this error? Player is not a valid member of Frame "LeaderboardFrame" - Server - LeaderboardHandler:32
I had this issue too until I realized that you just have to duplicate the Rank, Player, and Wins to the LeaderboardFrame in ReplicatedStorage and It should work fine
yes
@@contentcentral_ I have the same issue, what do you mean by your comment? I don’t understand what you’re saying.
@@thomasdevelops3087 you have to change the name of the frames like he does otherwise it doesnt work
@@charlie-deactivated You're pretty late :p It's been two month's and I made my own leaderboard instead
Positon is a pog way of saying position
Can someone make this a model lol, I'm to busy with my game to do this
Ikr
But if you do this, then you're still doing your job anyways 😂😂😂 you're still adding it to your game
not too busy just too lazy
Grammarly does more than just catch errors.
With Grammarly, you can find perfect words that make your writing sharp.
Player is not a valid member of Frame "LeaderBoardFrame" what should i do
Why does it say:
GlobalLeaderboard is not a valid member of Workspace "Workspace" - Server - LeaderboardHandler:42
Did I do something wrong? there's no typo there's no mistakes too! Please help me out :(
r u sure there's no typo? the script check if there's something called "GlobalLeaderBoard" inside of workspace, if there's no "GlobalLeaderBoard" it will send error
I saw the same thing and when I went to check my workspace, it turns out I named it “Global Leaderboard” (with a space) instead of “ GlobalLeaderboard” (without a space)
@@fluke5173 IT FINALLY WORKS!!!
If it's okay.. Can you make a tut of kills and deaths leader board?
@@FNMATFY just change it
its so easy
Hello DevKing! I was hoping that you make a video on GLOBAL Leaderboards but for MOST VISITS! Can you please do it? :D
It's the same thing just put a value in the player's leaderstats that adds a visit every time they join the game. Use that value instead of wins on the global leaderboard.
Inefficient way of saving...
Do u have a better suggestion
@@EpicVideoClips101 a few.
- avoid using a while loop for saving
- check for limits
- check if the saving was successful
- reattempt if something goes wrong
- keep a cache of player data in the server and not in the player so even if the player leaves you can save data efficiently
And so on
@@rodrigosimoes7103 is the while loop just to save? (ik there is a part where it updates the leaderboard but I'm not including that). If its only for saving the data (not including updating lb again) then it would be easier using datastore in the leaderstats script.
Sorry for the confusion if I did any