#Data save problem

1 messages · Page 1 of 1 (latest)

serene birch
#

Hi, I'm having problems when saving equipped units rejoining in the TD game I'm trying to make, I've tried many methods, even AI to try to find solutions but nothing, hope someone or some people can help me to find a way to make that happen

plucky urchin
#

wdym ‘even ai’

#

If anything ai is just fucking up ur code

serene birch
plucky urchin
#

why?

serene birch
#

To try to find a way to fix it, most of times is deceiving, I know

plucky urchin
#

send the code before you used ai?

serene birch
#

This is the one I made without AI

#

I went back from modifications when followed AI steps, so came back like in starting

#

Cuz AI was making things worse sometimes ngl

#

Also, just to save you time, I think the important thing from the module is the 1st function, cuz I tried changing a slot from nil to a unit name and it worked when joining in game

plucky urchin
#

I guess just debug it

#

See if functions are being called and whether data is being written

serene birch
#

I kind of tried some of that, but I can try that again

plucky urchin
#

u got api services on right

serene birch
#

Yh

#

The other stats work well

#

The units rolled are still kept in inventory

#

Gold and joins stats are saved

restive pecan
#

???

plucky urchin
#

tbh it looks like the whole code is just written by ai

#

game:GetService("Players").PlayerRemoving:Connect(function(player)
equippedTowers[player] = nil
end)

#

im not quite sure what your asking but

serene birch
plucky urchin
#

your setting the equipped towers to nil?

#

game:GetService("Players").PlayerRemoving:Connect(function(player)
equippedTowers[player] = nil
end)

serene birch
plucky urchin
#

?

serene birch
#

But after thinking for a while, this might even occur for players that already played the game

plucky urchin
#

did u even write this 🤦‍♂️

serene birch
plucky urchin
#

do you understand what this section of code does

#

game:GetService("Players").PlayerRemoving:Connect(function(player)
equippedTowers[player] = nil
end)

serene birch
#

Yes, it cleans the users' equipped units

hasty skiffBOT
#

studio** You are now Level 4! **studio

plucky urchin
serene birch
#

I tried removing that because I thought that might be the problem

serene birch
plucky urchin
#

so?

serene birch
#

I thought of that too, I removed it to see if the equipment is saved or not, but no

#

Tbh I don't see the difference with it or without, I'm just going to remove it

plucky urchin
#

u didn't write this 😄 don't lie

serene birch
#

I thought it was a good option to avoid to get the server laggy or something

#

Like when players rejoin many times and accumulates, idk

#

As you can see, there's a folder with string values that corresponds to the equipped units they are in different slots

#

And tbh, I'm not really advanced that much in scripting ngl, I'm still learning and trying new techniques

#

Btw, don't really mind the french comments, I speak french that's why, it's some notes for me to don't forget what part does what incase I forget

thin sable
#

yeah uhh

#

hate to break it to ya but it doesn't save because you din't put a save function

#

inside the .PlayerRemoving

serene birch
# thin sable inside the .PlayerRemoving

Ah ok, sorry for late reply, I didn't see your message, don't hesitate to ping me or reply me so I can get the notification, I've also updated the PlayerStats script a bit and seems to work better, there's just an error that appears

#

This error

#

From this part of the server script