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

Why does it show a red line under the "e" in "end"?

This is the code:

local player = game.Players.LocalPlayer local leaderstats = player:WaitForChild("leaderstats") local tokens = leaderstats:WaitForChild("Cash") local text = script.Parent

while true do text.Text = "????: "..Cash.Value" end

It doesnt show the value in the gui. ???? is an emoji

3 comments

0

the question marks are supposed to be an emoji

0

screnshot please

0

i cant add a screen shot for some weird reason

1 answer

✓ Accepted answer

You have unnecceessary string symbol (") on line after while true do:

-- you have:
text.Text = "????: "..Cash.Value"

-- should be:
text.Text = "????: "..Cash.Value -- here no "

Your script probably gives you time exhaustion error because you have while true do loop without a debounce, that means it will run infinitely with speed of sonic and crash your script, to prevent that you would use wait:

...
while true do
	text.Text = '????: ' .. Cash.Value

	wait(1) -- waits one second
end

But i have too much reputation to show you this method, GetPropertyChangedSignal is what you need, it's a function of Instance which returns an Event which fires when given Property changes, you would then connect it to the function so last part of your script would look like this:

...

local function Update()
	text.Text = '????: ' .. Cash.Value
end

--/This will fire every time value of cash changes
Cash:GetPropertyChangedSignal('Value'):Connect(Update)

Update() -- update for the first time

2 comments

0

it still doesn't work

0

i edited my answer, is that it?

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