Why is my code not working? If you can tell my why and send the working code, I will be grateful.
local button = script.Parent.TextButton
local player = game.Players.LocalPlayer
local canview = {"PizzaArmy333"}
if player.Name == canview then
print("Worked") --it does not print
button.Visible = true
else
button.Visible = false
print("Also worked") --does not print
end
1 Like
canview is a table. if you want only you to be able to see the gui, store canview as a string.
local button = script.Parent.TextButton
local player = game.Players.LocalPlayer
local canview = "PizzaArmy333"
if player.Name == canview then
print("Worked") --it does not print
button.Visible = true
else
button.Visible = false
print("Also worked") --does not print
end
No, I am going to hire moderators, so I need multiple people to be able to see it.
local button = script.Parent.TextButton
local player = game.Players.LocalPlayer
local canview = {"PizzaArmy333"}
if table.find (canView, player.Name) then
print("Worked") --it does not print
button.Visible = true
else
button.Visible = false
print("Also worked") --does not print
end
2 Likes
When I put that in, it did not show the button for me.
Edit: I did a little editing and I fixed it