Hello, my button is not showing up. No errors in the output.

Hello, my button is not showing up. No errors in the output.

Is this a localscript judging by the cyan outline?
We need a bit more info of the type of script it is and its location
It’s a server script in a button.

Put it in ServerScriptService and see if that changes anything, you may need to wait for PlayerGui to exist
I’ll try that, but I’m not sure.
Shouldn’t playergui be manipulated in the client? Or is it possible to do that in the server?
It’s possible on both. I think.
That do not change anything, weird.
Yes it’s more appropriate to do manipulations client sided, but they can also be manipulated from the Server as well.
Although I think it’s better for @OP to clone the button for staff members since exploiters can just change the visibility of the button themselves
@achdef Did you get any errors?
No, but I added a print to print all table members, it’s didn’t print me. I am in the table tho.
Maybe have it visible by default and delete it for player’s who aren’t admins? That way they can’t change the visibility of the button.
Yes that’s another to do it but I think the best course of action is to just clone to ensure that non admins will never get a chance to mess with it
@achdef Did you change any of the code? Did you only put the script in ServerScriptService or did you accidentally put anything else there?
I tried a new script but it’s still show for me.
script.Parent:Destroy()? If that’s in ServerScriptService, that’s just going to try to destroy the service, not the button. You need to reference the button and destroy that
It’s a local script in the gui now, but I’m on my nerves- WHY DO ITS DONT WORK? ![]()
Reason it doesn’t work is because PlayerAdded has no time to detect your client being added, there’s no need for a PlayerAdded in that case
You shouldn’t be using a server script for a client-based system. Use a local script to achieve your goal, as it can access PlayerGui.
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
if table.find(staff, Player.Name) then
Player.PlayerGui.GS.modelstaffbutton.Visible = true
end
Move the button to ReplicatedStorage then make a list of the admins
local admins = {} -- i recommend using the admin's id
-- then you can check when an admin joins
game.Players.PlayerAdded:Connect(function(plr)
if admins[plr.UserId] then
-- you can use a RemoteEvent to fire the client
game.ReplicatedStorage.Event:FireClient()
end
end)
Now on the client, you can duplicate the button to add it to the player’s PlayerGui
game.ReplicatedStorage.Event.OnClientEvent:Connect(function()
game.ReplicatedStorage.Button:Clone().Parent = game.Players.LocalPlayer.PlayerGui -- and so on to place the button where it should go
end)
2 things,
There’s an event to wait for the character, so you can just do this
local character = Player.Character or Player.CharacterAdded:Wait()
Although it’s unneeded in this case
Also again, making that local is a bad idea, exploiters can change the visibility themselves, no security is involved, it’s better to just destroy or clone
@GoteeSign That’s a good idea, but if you’re going to use a dictionary, you have to mention that the UserId must contain a value of true, so
local admins = {
[10] = true
}
Because without it, it’ll always return nil which will not give you admin privileges even if your userid is in the list, table.find is okay in this case
Also, you don’t need a remote event for this, you can just do the cloning on the server as well and it will still work fine
I finally ended up to send a chat message if they are not an staff and click the panel, and it’s work fine! Thanks for everyone help, including @EmbatTheHybrid!