Quick answer: Some target platforms’ string conversion follows OS locale — you get “1,5” instead of “1.5”. Force a known format with manual concatenation, or post-replace the separator before display.
A German player’s save shows “HP: 1,5” which then fails to parse back. The number was formatted with a locale-aware function.
Lock the Format
// build the string manually with known separators
var whole = floor(value);
var frac = round((value - whole) * 100);
var txt = string(whole) + "." + string(frac);
Constructing the string yourself never picks up locale rules — the period is literal.
Normalize After
txt = string_replace_all(string_format(value, 0, 2), ",", ".");
Quick fix for existing code — replace comma with period after formatting. Works as long as you never have thousands separators to worry about.
Round-Trip Save Data
If save files are locale-formatted, parsing on a different machine fails. Always save numbers in invariant format (or use JSON via json_stringify, which uses the spec-mandated period).
Verifying
The same save loads correctly on US English, German, French OS locales. Displayed numbers use whatever format you want everywhere — consistent across players.
“Locale-aware formatting + global data = bugs. Lock display format and serialize invariantly.”
For displayed numbers you genuinely want localized (in-game UI in a translated build), do that deliberately in the localization layer — not as a side-effect of string_format.