Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Player removing event which sends message to client and back not working?

Asked by 5 years ago

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)
0
and hi is not being printed. CaptainD_veloper 290 — 5y
0
Everything else is working right, it's just the messages are not printing correct? ItsBankai 31 — 5y
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. XviperIink 428 — 5y
0
Maybe. CaptainD_veloper 290 — 5y

Answer this question