Can someone help me to make it saving stats heres is the script and screenshots

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

this is my professional stats can someone help me to save it or DataStoreService

Stats Script:

game.Players.PlayerAdded:Connect(function(plr)
for i,v in pairs(script:GetChildren()) do
local StatsClone = v:Clone()
StatsClone.Parent = plr
end
end)

image

that is the inside of script or folder

first off, you are going to need to atleast ATTEMPT it before hand. It clearly states in the guidelines you dont ask for people to make scripts. Next time read the guidelines CAREFULLY. Now that we have that out of the way I recommend looking at DataStoerService. https://developer.roblox.com/en-us/articles/Data-store
http://developer.roblox.com/en-us/articles/Saving-Player-Data

Just look up a video on datastores. I know TheDevKing is a good YT channel that teachers all sorts of scripting such as datastores.

1 Like

yep but i cant fixed it buddy im TheDevKing fan

well we cant make scripts for you so the best option is to try your hardest to make a datasaving script and then show it to us if it doesnt work. please read the guidelines next time pal

1 Like

I would recommend using the DatastoreService or datastore2

https://developer.roblox.com/en-us/api-reference/class/DataStoreService

If you decide to use the DatastoreService i can give some advice:
When saving data remember, lua is case sensitive so you need to use:
:setAsync() not :SetAsync(), same goes for getting the data, use:
:getAsync() not :GetAsync(), also always save the data on the Players UserId and always wrap setAsync and getAsync into a pcall function.

Example script:

local DatastoreName = "" --The name of your datastore goes into the ""
local MyDatastore = game:GetService("DataStoreService"):GetDataStore(DatastoreName)
local DatastoreKey = "~Key~._" --Always save the data with a key (Replace the word " key " regarding on your data topic)

local MyData = "" --Remove the "" and put your data into there

game.Players.PlayerRemoving:Connect(function(Player)
	local data
	local Success,ErrorMessage = pcall(function()
		data = MyDatastore:setAsync(DatastoreKey..Player.UserId,MyData)
	end)
	
	if Success then
		warn("Data has been successfully saved")
	else
		warn("Something went wrong while saving the data for: "..Player.Name.."\nError: "..ErrorMessage)
	end
end)

game.Players.PlayerAdded:Connect(function(Player)
	local data
	local Success,ErrorMessage = pcall(function()
		data = MyDatastore:getAsync(DatastoreKey..Player.UserId)
	end)
	
	if Success then
		warn("Data has been received")
	else
		warn("Something went wrong while getting the data for: "..Player.Name.."\nError: "..ErrorMessage)
		Player:Kick("Something went wrong while getting your data")
	end
end)

If you experience issues while saving data inside studio do this:
Add a BindToClose function which will save the data when the game gets closed or Try it out in the actual game

https://developer.roblox.com/en-us/api-reference/function/DataModel/BindToClose

Also remember if you want something to work, do not copy entire scrips, write them yourself based on the script you’re trying to recreate

thanks buddy… let me fixed it

1 Like