Game Scorebox
Scoreboxes are literally "score boxes" where you can store numbers, attempts, collected potatoes, etc. Check if you have reached a limit or simply store the highest achievement.
Scorebox.Create()
important: these boxes only allow you to store integers
This function is used to create a score box for a specific score identifier. It checks if the score box with the given scoreId already exists, and if not, it creates it with the specified defaultValue (or 0 if no defaultValue is provided). The function returns the value of the score box.
Parameters:
scoreId: string (identifier for the score box)
defaultValue (optional): number (default value for the score box)
Returns:
number: The value of the score box.
Scorebox.Destroy()
This function is used to destroy a score box with the specified scoreId. If the score box exists, it is removed from the PMM.ScoreBoxes table and the function returns true. If the score box doesn't exist, the function returns false.
Parameters:
scoreId: string (identifier of the score box)
Returns:
boolean: true if the score box was successfully destroyed, false otherwise.
Scorebox.DestroyAll()
This function is used to destroy all score boxes. It clears the PMM.ScoreBoxes table, effectively removing all score boxes.
Scorebox.AddPoint()
This function is used to add points to a score box with the specified scoreId. If the score box exists, the function increments its value by the specified points.
Parameters:
scoreId: string (identifier of the score box)
points: number (points to add)
Scorebox.RemovePoint()
This function is used to subtract points from a score box with the specified scoreId. If the score box exists, the function decrements its value by the specified points.
Parameters:
scoreId: string (identifier of the score box)
points: number (points to subtract)
Scorebox.SetPoints()
This function is used to set the value of a score box with the specified scoreId. If the score box exists, the function updates its value to the specified points.
Parameters:
scoreId: string (identifier of the score box)
points: number (new value for the score box)
Scorebox.GetPoints()
This function is used to retrieve the value of a score box with the specified scoreId. If the score box exists, the function returns its value. If the score box doesn't exist, the function returns nil.
Parameters:
scoreId: string (identifier of the score box)
Returns:
number or nil: The value of the score box, or nil if the score box doesn't exist.
Last updated
Was this helpful?