So I’m having this issue where if a player dies while effects are out they freeze and don’t delete. Even if I use debris service and whatnot. Since I’m firing the effects to every player using fireallclients I tried doing the same when on death with humanoid.died function then fireserver to then fireallclients to get the playerdebris folder my script creates and clear it for every player in game but the information always came back nil as if the folder was never there to begin with. is there an easier or better solution then what im doing?
Humanoid.Died:Connect(function()
local plrdebris = workspace:FindFirstChild("PlayerDebris")
local plrfolder = plrdebris:FindFirstChild(Player.Name)
Destroy:FireServer(plrfolder)
end)
Destroy.OnClientEvent:Connect(function(plrfolder)
for i,v in pairs(plrfolder:GetChildren()) do
if v then
v:Destroy()
end
print("Success!")
end
end)
--server side
destroy.OnServerEvent:Connect(function(PlrName)
destroy:FireAllClients(PlrName)
end)
--how the folder is created from executing the move and recieving the info back on client side
Remote.OnClientEvent:Connect(function(Type,Models,Character,HumRT)
local PlayerDebris = workspace:FindFirstChild("PlayerDebris")
local PlrFolder = PlayerDebris:FindFirstChild(Player.Name) or Instance.new("Folder")
PlrFolder.Name = Player.Name
PlrFolder.Parent = PlayerDebris
if Type == "Grow" then
Grow(Models,PlrFolder,Character,HumRT)
elseif Type == "Shrink" then
Shrink(Models,PlrFolder,Character,HumRT)
end
end)