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

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

Asked by 3 years ago

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

0
the question marks are supposed to be an emoji Stikeys 9 — 3y
0
screnshot please AlexanderYar 788 — 3y
0
i cant add a screen shot for some weird reason Stikeys 9 — 3y

1 answer

Log in to vote
1
Answered by
imKirda 4491 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

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
0
it still doesn't work Stikeys 9 — 3y
0
i edited my answer, is that it? imKirda 4491 — 3y
Ad

Answer this question