Hello! I am using META Leaderboards by TeamMETA and Speedrun Timer by Aphrim. I am trying top post a BEST time to the leaderboard but do not understand how to pass the full time to the board using the resources. I can pass seconds or milliseconds. I have included a video here showing what I have going and that the World Leaderboard is working. If someone is willing to teach me how to pass that it would be awesome! Thanks in advance for your time. If not, Aphrim said he can pass me something Friday but I would love to get this feature done before then if possible.
Went another direction with this. Feel free to still answer for learning but wanted to update that I am no longer in need of this specific answer. Thanks for the time!
Yeah.... so Resources store integers. Since it looks like you want to save to two decimal places, what you can do is multiply the time by 100 and round that value. Then when you're getting the resource, divide the value by 100 and that will get you the time you want to display. A code example:
local time = 1.38 print("Player's time: "..time) local save = time * 100 print("Value to save: "..save) Player:SetResource("Time", save) print("Some time to update leaderboard") local data = Player:GetResource("Time") data = data/100 print("Time to display: "..data) --[[ Output: Player's time: 1.38 Value to save: 138.0 Some time to update leaderboard Time to display: 1.38 ]]
This has gotten me way closer. I can get the the time to post and have a decimal in a similar format to the following... 6.54 but then when I set a new time I must not have things quite in the right place because it is not updating the time when the update timer expires. I have done a faster time and a slower one and it is NOT updating for some reason. Any ideas, again... I am using the community content META Leaderboards and Speedrun Time and leaving everything stock when setting it up. Not adding scripts or anything but just trying to update those files. Thanks for the help! I am just trudging along and any bit that I learn is helpful.
Any other ideas?
I'm going to go to bed now, but when you think you didn't set up your code correctly then you should actually post the code.
Thanks and totally agree with you. Just not even sure I am in the right file to be totally honest within the CC imports and files. There are maybe three different files that I think could be impacted and it would be a really long post. I have created a template and made it public so you can check it out if you are willing. No pressure. You will have to set it up a little but...
- Find the template named "Help for Time Leaderboard" in community content
- Be sure to enable player storage
- Setup two leaderboards and connect them. Here is an example of the resource one I had connected... https://prnt.sc/w4si2f
That should do it for setup. I have been working in the following files...
- Timer > Timer Save Script
- World Leaderboard > Client Context > Leaderboard_World (client) > see line 165 comment
There were other files I was in but think I reverted those back to the beginning. I am close but am having a hard time figuring out stuff. If it is better to start from scratch I am doing the following...
- Import Speedrun Timer by Aphrim
- Import META Leaderboards by TeamMETA
- Enable Player Storage in Game settings
- Create leaderboards as needed
- Create a killzone in case you want to test to see if they are working (optional)
That is really it. Trying to get the time that I get from the buttons to the Global leaderboard for time.
Again, thanks for the help. I know this is a lot and if you don't want to or cannot dive in. I understand completely.
What do you when you say you wen another direction ? Did you find a solution ?
Speedrun Timer is great but seconds and milliseconds are stored in a different field.
One way around was to store [ Seconds * 3600 + Seconds * 60 + Milliseconds] in a third field.
Then you can access it in any leaderboard.
In the leaderboard script you will need to update the field again
Thanks for the follow up @ericzon . When I say I went another direction, someone helped me build a timer from scratch that was easier for me to use. However, no having more experience I maybe could get this one working as I was hoping. Thanks!