Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Why does the Font Size not change?

Asked by 9 years ago
local cash = script.Parent.Parent.Parent.Parent.Parent.Parent.Cash.Value
local text = script.Parent

if cash > 9999999 then
    text.FontSize = 36
end

This doesnt give me any errors but it also doesnt work.

0
I fixed my errors, if it doesn't work then reference "cash" differently (instead of cash = script.Parent.Parent.Parent.Parent.Parent.Parent.Cash.Value, do cash = script.Parent.Parent.Parent.Parent.Parent.Parent.Cash. and in if cash > 9999999 instead do if cash.Value > 9999999 BSIncorporated 640 — 9y
0
ok ill try AWESOMEnoob3 3 — 9y

2 answers

Log in to vote
0
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

Considering the amount of nines in your evaluation of cash's value, I assume you want the text's FontSize to increase if the cash's value is greater than or equal to a billion. Therefore, I simplified it into the code displayed below..

If the code below doesn't work, provide an output so that we know what exactly is the issue

local cash = script.Parent.Parent.Parent.Parent.Parent.Parent.Cash
local text = script.Parent

cash.Changed:connect(function()
    if cash.Value > 1e7 then
        text.FontSize = Enum.FontSize.Size36
    end
end)

1e7 represents the number 1 followed by 7 zeros, in other words one billion.

0
FYI: The output says: attempt to index field 'Text' (a string value) woodengop 1134 — 9y
0
'Text' ot 'text'..? Either way, perhaps AWESOMEnoob3 should consider checking that all variables are indeed existent. ImageLabel 1541 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

My guess that you wan't the FontSize to change when the cash becomes more or less than 9999999 You can do this in a few different ways, but I'm not going to post them all: Using While, do

local cash = script.Parent.Parent.Parent.Parent.Parent.Parent.Cash.Value
local text = script.Parent

while wait() do
    if cash > 9999999 then
    text.FontSize = 36
end
end

Using Changed function

local cash = script.Parent.Parent.Parent.Parent.Parent.Parent.Cash
local text = script.Parent

cash.Changed:connect(function()
    if cash > 9999999 then
    text.FontSize = 36
    end
end)
0
Did not work. It's fine. AWESOMEnoob3 3 — 9y

Answer this question