Hello there! Im making settings and save system. I got this script:
game.Players.PlayerRemoving:Connect(function(plr)
local data = game.ReplicatedStorage.RemoteFunctions.PlayerInfo:InvokeClient(plr)
print(data)
dataStore2('Settings',plr):Set(data)
print('End')
end)
But nothing prints. There’s a local script in invoke:
local rs = game.ReplicatedStorage
local plrModule = require(rs:WaitForChild('Modules').PlayerInfo)
rs.RemoteFunctions.PlayerInfo.OnClientInvoke =function()
print('B')
return plrModule.GetPlayerInfo()
end
Script doesnt save anything too. But if I put print like this:
game.Players.PlayerRemoving:Connect(function(plr)
print('a')
local data = game.ReplicatedStorage.RemoteFunctions.PlayerInfo:InvokeClient(plr)
print(data)
dataStore2('Settings',plr):Set(data)
print('End')
end)
It’s possible that the player instance is deleted when you press the invokeclient thing, resulting in you not getting a result - hence the freezing of the script
Correct, however that still would not cause the thread to yield if its return type was nil.
The print that is above the module which is supposed to return something does not get ran, which means the remote fails to invoke. Something fishy is going on.