This Code uses DataStore 2 and gives gold when a player kills another one. The problem is the stats gold isnt showing up and I am not sure if my code has a bug.
local DataStore2 = require(1936396537)
DataStore2.Combine("MasterKey","Gold")
game.Players.PlayerAdded:Connect(function(plr)
local dataGold = DataStore2("Gold", plr)
local folder = Instance.new("Folder",plr)
folder.Name = "leaderstats"
local gold = Instance.new("IntValue", folder)
gold.Name = "Gold"
local initialGold = 100
gold.Value = dataGold:Get(initialGold)
gold.Changed:Connect(function()
dataGold:Set(gold.Value)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local stats = tag.Value:WaitForChild("leaderstats")
stats["Gold"].Value = stats ["Gold"].Value + 150
end
end
end)
Please provide the problem, you literally just said how your script works only. We can help you by telling us what your code should do and what’s the problem/bug.
Well, you should put the end) before the last end), the image i sent had a drawing of my word “end)” that is supposed to be there, you could try it.
It could be the problem where you used a script that modifies the styles of some core graphical user interface, what script do you think you used to change the styles of the game’s GUIs?
Edit: But once again it wouldn’t be 80% the main issue about that bug that declines the leader statistics.