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

What is wrong with this code it doesn't let me see the button???

Asked by 7 years ago
Edited 7 years ago
local player = game.Players.LocalPlayer
local level = player.leaderstats.Level

if level.Value >= 1
 then player.PlayerGui.ScreenGui.TextButton.Visible = true
 else player.PlayerGui.ScreenGui.TextButton.Visible = false
end

this code is supposed to let the player see the button only after he reaches LVL.1 but it doesn't show it even after he reaches LVL.1

2 answers

Log in to vote
0
Answered by 7 years ago

Try this:


local player = game.Players.LocalPlayer
local level = player:WaitForChild("leaderstats"):WaitForChild("Level") 
while true do wait()
if level.Value >= 1
 then player.PlayerGui.ScreenGui.TextButton.Visible = true
 else player.PlayerGui.ScreenGui.TextButton.Visible = false
end
end
0
THANK YOU MAN Vlad_DraculaTV -2 — 7y
Ad
Log in to vote
0
Answered by
Zrxiis 26
7 years ago
Edited 7 years ago
--// I believe it would look more along the lines of this
local player = game.Players.LocalPlayer
local level = player.leaderstats.level
level.Changed:connect(function()
    if level.Value >= 1 then
        player.PlayerGui.ScreenGui.TextButton.Visible = true
    elseif level.Value < 1 then
        player.PlayerGui.ScreenGui.Textbutton.Visible = false
    end
end

Answer this question