Hello guys. I've been trying for hours to make a button invisible by having a certain amount of stats inside the "players/playername" folder when the player joins the game, but without any success. Did I do something wrong? Thanks in advance!
Here's the code:
local player = game.Players.LocalPlayer local lock = script.Parent.lock game.Players.PlayerAdded:Connect(function() if player.Powerlevel.Value >= 250 then lock.Visible = false end end)
Sorry, I am pretty new to scripting
local player = game.Players.LocalPlayer local lock = script.Parent.lock game.Players.PlayerAdded:Connect(function() if game.Players[player.Name].Powerlevel.Value >= 250 then lock.Visible = false end end)
Try this. I'm doing this blindly with no clue of what your hierarchy is
Try putting a local script as a child of the button you want to make invisible then put in this
local player = game.Players.LocalPlayer local stats = player:WaitForChild("leaderstats")--Gets the leaderstats from the local player local Powerlevel = stats:WaitForChild("Powerlevel")--Gets the powerlevel from the leaderstats game.Players.PlayerAdded:Connect(function() if Powerlevel.Value >= 250 then --if the local player power level is higher or equal to 250 then make the script's parent invisible script.Parent.Visible = false end end)
Tell me if it works!