However, .Text is a thing as seen here:
Here is the code:
local Player = game:GetService("Players").LocalPlayer
local PlayerData = Player:WaitForChild("PlayerData")
local function CommaValue(UnconvertedValue)
local FormattedValue = string.gsub(UnconvertedValue, "^(-?%d+)(%d%d%d)","%1,%2")
return FormattedValue
end
script.Parent.Text = CommaValue(PlayerData:GetAttribute("MultiplayerWins")) -- This here is line 9
PlayerData.AttributeChanged:Connect(function()
script.Parent.Text = CommaValue(PlayerData:GetAttribute("MultiplayerWins"))
end)
If you know how to fix, please let me know. Thanks! WE
Did your solution except for using RenderStepped:Wait(), and it worked. However, this is similar, and it doesn’t error:
local Player = game:GetService("Players").LocalPlayer
local Points = Player.leaderstats.Points
local function CommaValue(UnconvertedValue)
local FormattedValue = string.gsub(UnconvertedValue, "^(-?%d+)(%d%d%d)","%1,%2")
return FormattedValue
end
script.Parent.Text = CommaValue(Points.Value)
Points.Changed:Connect(function()
script.Parent.Text = CommaValue(Points.Value)
end)
Yes. Everything is fine. It is just that this script works for 1 stat with no errors, but not another stat.
local Player = game:GetService("Players").LocalPlayer
local Points = Player.leaderstats.Points
local function CommaValue(UnconvertedValue)
local FormattedValue = string.gsub(UnconvertedValue, "^(-?%d+)(%d%d%d)","%1,%2")
return FormattedValue
end
script.Parent.Text = CommaValue(Points.Value)
Points.Changed:Connect(function()
script.Parent.Text = CommaValue(Points.Value)
end)