For some unexplained reason all of my player removing functions have stopped working. Data store saving no longer works and custom player list both of which use player removing don’t work. I have changed some settings like, only allowing my game on computer, decreasing the amount of people to a server, and changed the privacy of the game to test something on my other account.
It’s definitely not an issue with PlayerRemoving, it’s your code. For example, you could be having a non-terminating loop that’s preventing any connections on PlayerRemoving from being reached. Supplying more information about your circumstances, especially code samples, would help out greatly here.
It probably would’ve been better to have posted this at an appropriate time when you were available and could supply such details then.
Rest well and hope to see some details bright and early so we can help you tackle your problem. Perhaps you might even find a solution yourself tomorrow before addressing this thread after doing a bit of your own debugging and reviews.
So I figured out my issue with data saving, it wasn’t updating on the server. I fixed that but now onto the player list… It works when adding a player but removing doesn’t.
This is in a local script in a screenGUI:
local players = game:GetService("Players")
local frame = script.Parent.ScrollingFrame
local slots = frame.slots
local temp = frame.Template
local players_table = {}
local function cleanup (slot)
repeat
wait()
until slot.Poition.X.Offset == 400
slot:Destroy()
end
local function remove(leaving)
if leaving then
local slot = slots:FindFirstChild(leaving)
slot:TweenPosition(UDim2.new(0,400,0,slot.Position.Y.Offset),Enum.EasingDirection.Out, Enum.EasingStyle.Linear,0.5,true)
local cor = coroutine.wrap(cleanup)
cor(slot)
end
end
local function add ()
local child = players:GetChildren()
for c = 1, #child do
if players_table[child[c].Name] == nil then
players_table[child[c].Name] = 1
local slot = temp:Clone()
slot.Name = child[c].Name
slot.Text = slot.Name
slot.Parent = slots
end
end
end
local function adjust(leaving)
add()
remove(leaving)
local count = 0
for key, value in pairs(players_table) do
count = count + 1
local slot = slots:FindFirstChild(key)
local ypos = 2 + (25+2)*(count-1)
slot:TweenPosition(UDim2.new(0,0,0, ypos),Enum.EasingDirection.Out, Enum.EasingStyle.Linear,0.5,true)
end
end
players.PlayerAdded:Connect(function()
adjust(nil)
end)
players.PlayerRemoving:Connect(function(leaving)
adjust(leaving.Name)
end)
adjust()