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
01 | local players = game:GetService( "Players" ) |
02 |
03 | function addPlayer(player) |
04 | local isVip = { [ "WillBe_Stoped" ] = true , [ "" ] = true , [ "" ] = true , [ "" ] = true , [ "" ] = true , [ "" ] = true } |
05 | if isVip [ game.Players.LocalPlayer.Name ] then |
06 | script.Parent.Visible = true |
07 | end |
08 | end |
09 |
10 |
11 | for _,player in pairs (players:GetPlayers()) do |
12 | addPlayer(player) |
13 | end |
14 |
15 |
16 | players.PlayerAdded:connect(addPlayer) -- local script (This one works) |
17 | -- 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.
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.ReplicatedStorage.DisableBalls:FireServer() |
3 | end ) -- also a local script |
now for my final script
1 | game.ReplicatedStorage.DisableBalls.OnServerEvent:Connect( function () |
2 | -- 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) |
3 | 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.
1 | for _, v in pairs (game.Players:GetPlayers()) do |
2 | -- code |
3 | 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! :)