Removing a players name from Table?
So basically what I have is a script for a scrolling frame, and when it is opened, it lists all the players in the game except for player that carries the script. I've added all the players into a table, and I've run a loop so that for how many players are in the game, a new frame will be there and visible with the players name on it
For some reason this block of code is not working, I've run print on both variables to see specifically if they do equal each other, which they do when the loop runs through the table and gets the player who ones the scripts name, but for some reason it's not running the if part of the the if else statement
1 | if players [ countertwo ] = = playerName then |
2 | table.remove(players, countertwo) |
3 | countertwo = countertwo + 1 |
02 | local frame = script.Parent.ScrollingFrame |
04 | local textboxes = script.Parent.ScrollingFrame:GetChildren() |
05 | local players = game.Players:GetChildren() |
06 | local frames = #players |
07 | local playerName = script.Parent.Parent.Parent.Parent.Parent |
10 | function onItemSelected(item) |
12 | _G.itemSelected = item |
16 | function onMouseButton 1 Down() |
18 | if _G.Selected = = 0 then |
20 | while countertwo < = frames do |
21 | if players [ countertwo ] = = playerName then |
22 | table.remove(players, countertwo) |
23 | countertwo = countertwo + 1 |
25 | frame:FindFirstChild( tostring (textboxes [ countertwo ] )).Name = |
26 | tostring (players [ countertwo ] ) |
27 | frame:FindFirstChild( tostring (players [ countertwo ] )).Visible = true |
28 | frame:FindFirstChild( tostring (players [ countertwo ] )).Name = tostring (players [ countertwo ] ) |
29 | frame:FindFirstChild( tostring (players [ countertwo ] )).Text = tostring (players [ countertwo ] ) |
30 | countertwo = countertwo + 1 |