Follow@Orbular3's Example, it is the correct and common way to create leaderstats. Plus, those Variables are used in this Example, pretty simple one.
Might Work However,
Script:
-- Above Should be PlayerAdded stuff seen in Orbular3's Example
player.CharacterAdded:Connext(char)
while task.wait() do
value.Value = math.floor(char.PrimaryPart.Position.Y)
end
end)
end) -- End of Orbular3's PlayerAdded example
It might be preferable, if time isn’t an issue for OP, to use an event-based paradigm here as opposed to a continuously running loop that uses more resources.
With that in mind, here is how I developed a co-ordinate system that only updates via events.
It’s better to update the value only when the value is changed compared to every frame as then the code will only be run when necessary - for example, you don’t want the loop to continue when the player is just on the floor because that’s a waste
Just better optimisation overall to use events instead
If this practice were to be implemented in a game with 50 players a server however, with extra code executing as the player’s position changes, then the server has 50 threads running simultaneously all accounting for the same variables spanning across 50 players.
With event-based programming, only one loop has to be active at a time in the background, allowing the developer to abstract away logic and focus on imperatives influencing the values and attributes of the player.
Hope this clarifies why it doesn’t matter at this stage, but would in a context with more players.