**What do you want to achieve?
To update the leaderstats best value with a number value
What is the issue?
The leaderstats wont update it displays 0 when a value is set
What solutions have you tried so far?
Looking on the dev.hub y.t and google
The scripts are to make a speed run style obbly. This would be timed for the full run. and players best time displayed on the leaderstats. so they have a target to beat.(I have a working stopwatch Gui)
I am planing to implement an ordered data store global leaderboard to display the best (lowest time)
I am really not sure how to achieve this correctly. One step at a time though.
I know that getting the players ‘best’ (lowest time) into the leaderstats is a good place to start.
Hello the problem is the leaderstats ‘best’ wont update to the current Number.Value
I have a local script in starterGui that controls a stopwatch timer that is activated/deactivated by touching blocks.
The finalTime variable is sent to a number value when the stopwatch stops (BestTimeNV)
That is located in StarterPlayer.StarterPlayer.Scripts
If i manually set the Number.Value to = 100 this will display in the ‘best’ leaderstats
but when the Number.Value starts from 0 and ‘records’ the final time this is not updated by
‘best’ in leaderstats.
I would appreciate pointers for the ‘best’ displaying the lowest best p.b time. overwriting if the time is lower than previous best.
I will attach the two leaderstats scripts (these are regular scripts)
local function onPlayerJoin(player) local leaderstats = Instance.new('Folder') leaderstats.Name = 'leaderstats' leaderstats.Parent = player local best = Instance.new('NumberValue') best.Name = 'Best' best.Value = 0 best.Parent = leaderstats end game.Players.PlayerAdded:Connect(onPlayerJoin)
local function addTime(player) local bestime = game.StarterPlayer.StarterPlayerScripts.Bv:FindFirstChild("BestTimeNV") while true do wait(1) bestime:GetPropertyChangedSignal("Value"):Connect(function(player) end) print(bestime.Value.. "this is the timer script bestime") player.leaderstats.Best.Value = player.leaderstats.Best.Value + bestime.Value end end game.Players.PlayerAdded:Connect(addTime)
I would like any advice please I know this is a probably simple solution for someone
who proficient at roblox lua, I am just starting out (if you cant tell!)
I can include the stopwatch script if it is needed.