Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you save tools when leaving the server?

Asked by 3 years ago

How can u save your data of tools I made a button that will give sword if you have 1000 Coins and put it on Backpack and Starter Gear But it won't save when i leave the server and rejoin back again I want to save it but I don't know how to save it please help me.

0
why no show script?, anyway, use datastore service to set async of the tools name, and when a player joins clone the tool to their starter gear and backpack if they have, so like if savedTools:GetAsync(plr.UserId)~=nil then game.ServerStorage.Tools[savedTools:GetAsync(plr.UserId)]:Clone().Parent=plr.Backpack game.ServerStorage.Tools[savedTools:GetAsync(plr.UserId)]:Clone().Parent=plr.StarterGear E yumaking 78 — 3y

3 answers

Log in to vote
1
Answered by
Dfzoz 489 Moderation Voter
3 years ago
Edited 3 years ago

Check this service DataStoreService as well as theses functions UpdateAsync and GetAsync. They will help you. There are code samples at the end of these pages too.

Take into account you can't save Instances, but you can save a value like a string or a boolean value to know if someone should have the item, and then give it to them.

Ad
Log in to vote
0
Answered by
MemezyDev 172
3 years ago
Edited 3 years ago

You can't exactly save a tool using the DataStoreService, but what you can do is save a value, such as a string or a number that identifies what tool they have upon leaving. Then, you will be able to add the tool to the players backpack once they joined. If this is the answer you needed, please accept my answer! If you need any more help, feel free to ping me in the community chat. Thanks!

Log in to vote
0
Answered by 3 years ago

I'm not sure if I'm meant to post YouTube tutorials, but this one by Shirooo may help you out. I have followed another one of her tutorials (for player list) and it was easy to follow and well explained.

Link: https://www.youtube.com/watch?v=E082PFJJHOM

Answer this question