So I've Made a local script which every time a player joins it checks to see if the player is in the list/table if that person is then the GUI/TextButton Shows up. heres the script
local players = game:GetService("Players") function addPlayer(player) local isVip = {["WillBe_Stoped"] = true, [""] = true, [""] = true,[""]= true,[""]= true,[""]= true} if isVip[game.Players.LocalPlayer.Name] then script.Parent.Visible = true end end for _,player in pairs(players:GetPlayers())do addPlayer(player) end players.PlayerAdded:connect(addPlayer) -- local script (This one works) -- I added this script to show what im doing
Now for my other scripts. This one is inside the TextButton so when you click it, it should fire an event.
script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.DisableBalls:FireServer() end) -- also a local script
now for my final script
game.ReplicatedStorage.DisableBalls.OnServerEvent:Connect(function() -- inside here i have no idea what to put.(Im tryning to make it so that when the Admin/VIP person Clicks the TextButton It Should Disable another GUI for everyone else) end)
i may suck at explaining but you can ask me questions in comments xd
Well, if you wanted to get every player within the server script, a simple for
loop should suffice.
for _, v in pairs(game.Players:GetPlayers()) do -- code end
This for loop iterates through all the players in your game. You can change something about the player by referencing v
, such as v.PlayerGui
.
I hope my answer has somewhat helped you, if it did remember to accept it. If you require further assistance, then please let me know! :)