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

Text wont visible when <0 or other way?

Asked by
TechModel 118
3 years ago
Edited 3 years ago

Don't have much to explain but it doesnt work as intneded. I wnat the text to be visible when the player has at least 1 or more money then the text is visible.

Stolen is the value of cash if you're confused with that

while wait(1) do
    script.Parent.Text = "$"..game.Players.LocalPlayer.stats.Stolen.Value
    if game.Players.LocalPlayer.stats.Stolen.Value == 0 then
        script.Parent.TextTransparency = 0
    elseif
        game.Players.LocalPlayer.stats.Stolen.Value <1 then

        script.Parent.TextTransparency = 1
    end
    end

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

Your problem is that you are using the less than sign instead of greater than or equal to. Your code should look like this:

while wait(1) do
    script.Parent.Text = "$"..game.Players.LocalPlayer.stats.Stolen.Value
    if game.Players.LocalPlayer.stats.Stolen.Value == 0 then
        script.Parent.TextTransparency = 0
    elseif
        game.Players.LocalPlayer.stats.Stolen.Value >= 1 then

        script.Parent.TextTransparency = 1
    end
end

Line 6 now checks if the value is greater than or equal to 1 instead of if it is less than 1.

Hope that helped!

0
Thanks! TechModel 118 — 3y
Ad

Answer this question