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

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

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

✓ Accepted answer

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

1 comment

0

THANK YOU MAN

--// 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

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