Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does the Font Size not change?

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.

2 comments

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

0

ok ill try

2 answers

✓ Accepted answer

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.

2 comments

0

FYI: The output says: attempt to index field 'Text' (a string value)

0

'Text' ot 'text'..? Either way, perhaps AWESOMEnoob3 should consider checking that all variables are indeed existent.

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)

1 comment

0

Did not work. It's fine.

This discussion is preserved as it was. New answers, comments, and votes are closed.