idk whats wrong here. It works fine in normal roblox studio testing but once i do the server and clients test thing it wont work. The data saving itself does work tho js not the part where its supposed to save the setting. (i did this with a tutorial cuz im still learning and tried to implement the AFK setting saving thing)
#It wont save the AFK setting
1 messages · Page 1 of 1 (latest)
FireServer("on")
FireServer("off"):
FireServer(true)
FireServer(false)
Replicated.Remotes.AFKHandlerEvent.OnServerEvent:Connect(function(EventPlayer, status)
if player == EventPlayer then
sessionData[player.UserId].Settings.AFK = status
end
end):
Replicated.Remotes.AFKHandlerEvent.OnServerEvent:Connect(function(player, status)
if sessionData[player.UserId] then
sessionData[player.UserId].Settings.AFK = status
end
end)
OnClientEvent:Connect(function(player, on):
OnClientEvent:Connect(function(on)
I will be glad if I helped, and if not, please indicate where the mistake occurred?
Thanks I‘ll try it out, but I got a question doesn‘t
if sessionData[player.UserId] then
just check if theres something in the sessionData table for that user?
yeah so you need to put it outside of whatever youre currently inside
helps with overall performance too, since youre not connecting the remoteevent everytime a player joins
do i put the coins.Changed function outside too or not?
forgot to say that it works now so thanks for that but i dont understand why you changed the if statement it works fine with the player == EventPlayer
memory leaks
your previous code is making connection everytime a player joins, and its not getting cleaned up either
if 100+ player joined a server, the server is gonna be hell