So I have a pet game, which after a player leaves, makes a table of the players pets. The pets are then saved. The problem is that the message never reaches the client. Here is my server script:

   local rs = game:GetService("ReplicatedStorage")

local event = rs:WaitForChild("PlayerRemoveClient")

local event2 = rs:WaitForChild("PlayerRemoveServer")

  

game.Players.PlayerRemoving:Connect(function(plr)

print("bye")

event:FireClient(plr)

end)

event2.OnServerEvent:Connect(function(plr, t)

print(unpack(t));

  

end)

Here is my local script:

    local rs = game:GetService("ReplicatedStorage")

local event = rs:WaitForChild("PlayerRemoveClient")

local event2 = rs:WaitForChild("PlayerRemoveServer")

  

event.OnClientEvent:Connect(function()

print("hi")

local t = {}

for i,v in pairs(script.Parent:GetChildren()) do

if v:IsA("ViewportFrame") and v.Name ~= "ZZ" then

table.insert(t, v.Name)

end

end

  

event2:FireServer(t)

end)

4 comments

0

and hi is not being printed.

0

Everything else is working right, it's just the messages are not printing correct?

0

i believe that it might be because the player had left the game with the script(s) in it which it doesnt detect the event that has been fired in time. Dont mark my words for it, i just guessing that it might be because of that.

0

Maybe.