So I'm creating a tool to give me plus 1 coin so I created a data store leader stats it works fine i tested it with the developer console but it doesn't save the tool coins here is the data store leaderstats :
local DataStore = game:GetService("DataStoreService")
local DS1 = DataStore:GetDataStore("CoinsDataStore")
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder",plr)
leaderstats.Name = "leaderstats"
local Coins = Instance.new("IntValue",leaderstats)
Coins.Name = "Coins"
Coins.Value = 0
Coins.Value = DS1:GetAsync(plr.UserId) or 0
DS1:SetAsync(plr.UserId,Coins.Value)
Coins.Changed:Connect(function(plr)
DS1:SetAsync(plr.UserId,Coins.Value)
end)
end)
##Tool script:
-- Tool Script that give +1 click when clicking a tool
local leaderstats = game.Players.LocalPlayer.leaderstats
local Coins = leaderstats.Coins
local Cooldown = false
script.Parent.Activated:Connect(function()
if Cooldown == true then return end
if Cooldown == false then
Cooldown = true
Coins.Value = Coins.Value +1
wait(0.8)
Cooldown = false
end
end)
It's not saving my coins from the tool when i click i do get +1 coins but it dosen't and i have not problem with my datastore what did i do that it's not saving what i get from the tools.
