What do you want to achieve? Keep it simple and clear!
Topic explains all
What is the issue? Include screenshots / videos if possible!
For some reason text for player is not getting updated. That only happens when amount sent to function = cap of how much you can have amount. I have no point why this happens
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I tryed added some prints and all if statements run perfeclty
Code:
function ClientFunctions:UpdateStats(player, amount, cap, valueType)
print(amount, cap, valueType)
if valueType == "Photons" then
print("continue")
if amount == nil and cap == nil then
amount = ValueFixer(ClientData.GetValue(player, valueType, "Current"))
cap = ValueFixer(ClientData.GetUpgrade(player, "PhotonUpgrades", "Cap", "TotalBonus"))
end
if ValueFixer(amount) < ValueFixer(cap) then
player.PlayerGui.GameGUI.Count.TextColor3 = Color3.new(1, 1, 1)
player.PlayerGui.GameGUI:WaitForChild("Count").Text = amount:GetSuffix(true).."/"..cap:GetSuffix(true).." Photons"
elseif ValueFixer(amount) >= ValueFixer(cap) then
print("updated")
-- here text not updating, in previous everything fine
player.PlayerGui.GameGUI.Count.Text = amount:GetSuffix(true).."/"..cap:GetSuffix(true).." Photons"
player.PlayerGui.GameGUI.Count.TextColor3 = Color3.new(0.333333, 0, 0)
end
end
end
From what i saw the line that is not working is pretty much the same as an line thats a little above it, maybe you could use that same line in the part thats not working? like this:
if ValueFixer(amount) < ValueFixer(cap) then
player.PlayerGui.GameGUI.Count.TextColor3 = Color3.new(1, 1, 1)
player.PlayerGui.GameGUI:WaitForChild("Count").Text = amount:GetSuffix(true).."/"..cap:GetSuffix(true).." Photons"
elseif ValueFixer(amount) >= ValueFixer(cap) then
print("updated")
-- here text not updating, in previous everything fine
player.PlayerGui.GameGUI:WaitForChild("Count").Text = amount:GetSuffix(true).."/"..cap:GetSuffix(true).." Photons"
player.PlayerGui.GameGUI.Count.TextColor3 = Color3.new(0.333333, 0, 0)
end
Also, you should try using string.format, it should be better than string concatenation, an example of using it in this scenario would be: player.PlayerGui.GameGUI:WaitForChild("Count").Text = string.format("%s/%s Photons", amount:GetSuffix(true), cap:GetSuffix(true))
I cant see any errors on that part that makes the text not update, the only reasonable thing i thought to do is use the same line that worked in the one that didn’t work, but i will take another look into the script and see if i can help, also, string.format is just an better way of formatting the string, i don’t know if it will fix the issue