I have a function that fires when a player leaves. It calls another function to save.
I tried to fire a remote event before or after the save function is called. Roblox Studio got piled with errors from roblox core scripts. I also tried separating them into two scripts, which also got the same result.
The remote event only fires a small string and the player removing object.
game.Players.PlayerRemoving:Connect(function(player)
save(player)
game.ReplicatedStorage.RemoteFunction:FireAllClients(player)-- this is what messes it up
end)
function save(player) -- normal datastore plugin
local sucess, err = pcall(function()
workpoints:SetAsync(tostring(player.UserId),player.leaderstats.WorkPoints.Value)
end)
end
Could you also post the errors roblox is throwing? It is quite normal to get some roblox corescript errors in studio testing. I usually get some ‘Unable to load asset’ errors due to a faulty connection.