Need help with script

don’t work :frowning:
idk why …

I made some changes and its work :slight_smile:

local DataStoreService = game:GetService("DataStoreService")

local DataStore = DataStoreService:GetDataStore("PetsStats") -- Change this with a different name.

local DataStoreService = game:GetService("DataStoreService")

local DataStore = DataStoreService:GetDataStore("SkyStats") -- Change this with a different name.

game.Players.PlayerAdded:Connect(function(Player)

	local LeaderstatsP = Instance.new("Folder", Player)

	LeaderstatsP.Name = "leaderstatsP"

	local completed = Instance.new('Folder')

	completed.Name = 'completed'

	completed.Parent = Player

	local Pets = Instance.new("IntValue", Player.leaderstatsP)

	Pets.Name = "Pets" -- Change "Kills" with your currency.

	Pets.Value = 0 or DataStore

	local Data = DataStore:GetAsync(Player.UserId)

	local Sky = Instance.new("IntValue", Player.leaderstatsP)

	Sky.Name = "Sky" -- Change "Kills" with your currency.

	Sky.Value = 0 or DataStore
	
	if Sky.Value == 1 then
		game.StarterGui.SkyScript.Disabled = false
		wait(10)
		game.StarterGui.SkyScript.Disabled = true
	end


	local Data = DataStore:GetAsync(Player.UserId)

	local FirePet = Instance.new("IntValue", Player.leaderstatsP)

	FirePet.Name = "FirePet" -- Change "Kills" with your currency.

	FirePet.Value = 0

	if Data then

		Pets.Value = Data.Pets -- Change "Kills" with your currency.

		Sky.Value = Data.Sky -- Change "Kills" with your currency.

	end

end)

game.Players.PlayerRemoving:Connect(function(Player)

	DataStore:SetAsync(Player.UserId, {

		["Pets"] = Player.leaderstatsP.Pets.Value; -- Change "Kills" with your currency.

		["Sky"] = Player.leaderstatsP.Sky.Value; -- Change "Kills" with your currency.

	})

end)
1 Like

tysm bro tysm :slight_smile: .

2 Likes