Help to fix daily chest

hello, I want to add a day chest, but the trouble is when I add it, I have to add coins in leaderstats, but I don’t want to do it, help me do it

1 Like

If you have to do something otherwise it won’t work you need to do it. What you said also doesn’t make much sense.

1 Like

you didn’t understand me correctly, I’m not talking about this now I’ll send you a screenshot as I don’t want it to be

1 Like

I don’t want the coins to show up here
Screenshot_1

will you help to do this or not?

1 Like

If you don’t want the coins to show up then don’t parent them to Leaderstats.

1 Like

and where then to add how the player then has to get coins?

1 Like

my leaderstats script

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

	local stats = Instance.new("Folder",player)
	stats.Name = "leaderstats"

	local Title = Instance.new("StringValue",stats)
	Title.Name = "Status"
	Title.Value = "Innocent"

	local Streak = Instance.new("IntValue", stats)
	Streak.Name = "Killstreak"
	Streak.Value = 0

	local Rep = Instance.new("NumberValue", player)
	Rep.Name = "Reputation"
	Rep.Value = 0
	
	local Class = Instance.new("StringValue", player)
	Class.Name = "Class"
	Class.Value = "F-Class"
	
	local BestFusion = Instance.new("Folder", player)
	BestFusion.Name = "BestFusion"
	
	local bestFusionName = Instance.new("StringValue", BestFusion)
	bestFusionName.Name = "FusionName"
	bestFusionName.Value = "None"
	
	local bestFusionMult = Instance.new("IntValue", BestFusion)
	bestFusionMult.Name = "FusionMulti"
	bestFusionMult.Value = 1

	local coins = Instance.new("NumberValue", player)
	coins.Name = "Coins"
	coins.Value = 0

	local totalCoins = Instance.new("NumberValue", player)
	totalCoins.Name = "TotalCoins"
	totalCoins.Value = 0

	local strength = Instance.new("NumberValue", player)
	strength.Name = "Strength"
	strength.Value = 0
	
	local agility = Instance.new("NumberValue", player)
	agility.Name = "Agility"
	agility.Value = 0

	local psp = Instance.new("NumberValue", player)
	psp.Name = "Psp"
	psp.Value = 0

	local Mult  = Instance.new("NumberValue", player)
	Mult.Name = "Multi"
	Mult.Value = 1

	local eMult  = Instance.new("NumberValue", player)
	eMult.Name = "eMulti"
	eMult.Value = 1

	local pMult  = Instance.new("NumberValue", player)
	pMult.Name = "pMulti"
	pMult.Value = 1
	
	local aMult  = Instance.new("NumberValue", player)
	aMult.Name = "aMulti"
	aMult.Value = 1

	local zoneMult = Instance.new("NumberValue", player)
	zoneMult.Name = "ZoneMulti"
	zoneMult.Value = 1

	local eZoneMult = Instance.new("NumberValue", player)
	eZoneMult.Name = "eZoneMulti"
	eZoneMult.Value = 1
	
	local pZoneMult = Instance.new("NumberValue", player)
	pZoneMult.Name = "pZoneMulti"
	pZoneMult.Value = 1
	
	local aZoneMult = Instance.new("NumberValue", player)
	aZoneMult.Name = "aZoneMulti"
	aZoneMult.Value = 1

	local End = Instance.new("NumberValue", player)
	End.Name = "Endurance"
	End.Value = 0
	
	local tp = Instance.new("NumberValue", player)
	tp.Name = "TotalPower"
	tp.Value = strength.Value + psp.Value + End.Value
	
	local quest = Instance.new("IntValue", player)
	quest.Name = "questNum"
	quest.Value = 0

	local str4Q = Instance.new("NumberValue", player)
	str4Q.Name = "str4Q"
	str4Q.Value = 0
	
	local hasClickedQuest = Instance.new("BoolValue", player)
	hasClickedQuest.Name = "hasClickedQuest"
	hasClickedQuest.Value = false
	
	local safe = Instance.new("BoolValue", player)
	safe.Name = "Safe"
	safe.Value = true
	
	local powers = Instance.new("Folder", player)
	powers.Name = "Powers"
	
	local hasAura = Instance.new("BoolValue", powers)
	hasAura.Name = "hasAura"
	hasAura.Value = false
	
	local hasFly = Instance.new("BoolValue", powers)
	hasFly.Name = "hasFly"
	hasFly.Value = false
	
	local hasEnergyPunch = Instance.new("BoolValue", powers)
	hasEnergyPunch.Name = "hasEnergyPunch"
	hasEnergyPunch.Value = true
	
	local hasInvisiblity = Instance.new("BoolValue", powers)
	hasInvisiblity.Name = "hasInvisiblity"
	hasInvisiblity.Value = false
	
	local hasInvisible = Instance.new("BoolValue", player)
	hasInvisible.Name = "isInvisible"
	hasInvisible.Value = false
	
	local questInfo = Instance.new("Folder", player)
	questInfo.Name = "QuestInfo"

	local questTargetStat = Instance.new("StringValue", questInfo)
	questTargetStat.Name ="Stat"
	questTargetStat.Value = "None"

	local questTargetVal = Instance.new("NumberValue", questInfo)
	questTargetVal.Name ="Value"
	questTargetVal.Value = 0
	
	local redeemedCodes = Instance.new("StringValue", player)
	redeemedCodes.Name = "RedeemedCodes"
	redeemedCodes.Value = ""
	
	strength.Changed:Connect(function()
		tp.Value = strength.Value + psp.Value + End.Value
	end)
	
	psp.Changed:Connect(function()
		tp.Value = strength.Value + psp.Value + End.Value
	end)
	
	End.Changed:Connect(function()
		tp.Value = strength.Value + psp.Value + End.Value
	end)
	Rep.Changed:Connect(function()
		if Rep.Value == 0 then
		elseif Rep.Value >= 5 and Rep.Value < 10 then
			Title.Value = "Savior"
		elseif Rep.Value >= 15 and Rep.Value < 30 then
			Title.Value = "Guardian"
		elseif Rep.Value >= 30 and Rep.Value < 70 then
			Title.Value = "Officer"
		elseif Rep.Value >= 70 and Rep.Value < 125 then
			Title.Value = "Angel"
		elseif Rep.Value >= 125 and Rep.Value < 150 then
			Title.Value = "Defender"
		elseif Rep.Value >= 150 then
			Title.Value = "Superhero"
		elseif Rep.Value <= -5 and Rep.Value > -10 then
			Title.Value = "Evil"
		elseif Rep.Value <= -15 and Rep.Value > -30 then
			Title.Value = "Demon"
		elseif Rep.Value <= -30 and Rep.Value > -70 then
			Title.Value = "Criminal"
		elseif Rep.Value <= -70 and Rep.Value > -125 then
			Title.Value = "Crook"
		elseif Rep.Value <= -125 and Rep.Value > -150 then
			Title.Value = "Assassin"
		elseif Rep.Value <= -150 then
			Title.Value = "Supervillian"
		end
	end)
	
	if player.Name == "Lamino961" then
		player.Chatted:Connect(function(msg)
			if msg == "/admin" then
				if player.PlayerGui:FindFirstChild("AdminPanel") then
					player.PlayerGui:FindFirstChild("AdminPanel"):Destroy()
				else
					game.ServerStorage.AdminStuff.AdminPanel:Clone().Parent = player.PlayerGui
				end
			end
		end)
	end
	
	local function ownsgamepass(userId, gamepassId)
		local s,res = pcall(MarketPlaceService.UserOwnsGamePassAsync, MarketPlaceService, userId, gamepassId)
		if not s then
			res = false
		end
		return res
	end
	
	while wait(60) do
		if ownsgamepass(player.UserId, 251310342) then
			coins.Value += 1000
			totalCoins.Value += 500*2
	else
		coins.Value += 5
		totalCoins.Value += 5
			
    	end
	end
end)
1 Like

I don’t know, to the Player itself? The only way the leadesrats render numbers or text is by Int/String Values. Make coins an attribute

1 Like

It’s like an attribute for the first time I hear about it

1 Like
1 Like

and this will help me so that it doesn’t show up in the leaderboards, right?

1 Like

Yes.

1 Like

error

Workspace.Daily Reward.Coin Giver.Coin.Script:11: attempt to index nil with ‘Value’ - Server - Script:11

1 Like

If you do not want to show the player’s stats there, then you just have to change the name of the stats in the script. I have edited the script and this should be what your looking for:

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

local stats = Instance.new(“Folder”,player)
stats.Name = “stats”

local Title = Instance.new(“StringValue”,stats)
Title.Name = “Status”
Title.Value = “Innocent”

local Streak = Instance.new(“IntValue”, stats)
Streak.Name = “Killstreak”
Streak.Value = 0

local Rep = Instance.new(“NumberValue”, player)
Rep.Name = “Reputation”
Rep.Value = 0

local Class = Instance.new(“StringValue”, player)
Class.Name = “Class”
Class.Value = “F-Class”

local BestFusion = Instance.new(“Folder”, player)
BestFusion.Name = “BestFusion”

local bestFusionName = Instance.new(“StringValue”, BestFusion)
bestFusionName.Name = “FusionName”
bestFusionName.Value = “None”

local bestFusionMult = Instance.new(“IntValue”, BestFusion)
bestFusionMult.Name = “FusionMulti”
bestFusionMult.Value = 1

local coins = Instance.new(“NumberValue”, player)
coins.Name = “Coins”
coins.Value = 0

local totalCoins = Instance.new(“NumberValue”, player)
totalCoins.Name = “TotalCoins”
totalCoins.Value = 0

local strength = Instance.new(“NumberValue”, player)
strength.Name = “Strength”
strength.Value = 0

local agility = Instance.new(“NumberValue”, player)
agility.Name = “Agility”
agility.Value = 0

local psp = Instance.new(“NumberValue”, player)
psp.Name = “Psp”
psp.Value = 0

local Mult = Instance.new(“NumberValue”, player)
Mult.Name = “Multi”
Mult.Value = 1

local eMult = Instance.new(“NumberValue”, player)
eMult.Name = “eMulti”
eMult.Value = 1

local pMult = Instance.new(“NumberValue”, player)
pMult.Name = “pMulti”
pMult.Value = 1

local aMult = Instance.new(“NumberValue”, player)
aMult.Name = “aMulti”
aMult.Value = 1

local zoneMult = Instance.new(“NumberValue”, player)
zoneMult.Name = “ZoneMulti”
zoneMult.Value = 1

local eZoneMult = Instance.new(“NumberValue”, player)
eZoneMult.Name = “eZoneMulti”
eZoneMult.Value = 1

local pZoneMult = Instance.new(“NumberValue”, player)
pZoneMult.Name = “pZoneMulti”
pZoneMult.Value = 1

local aZoneMult = Instance.new(“NumberValue”, player)
aZoneMult.Name = “aZoneMulti”
aZoneMult.Value = 1

local End = Instance.new(“NumberValue”, player)
End.Name = “Endurance”
End.Value = 0

local tp = Instance.new(“NumberValue”, player)
tp.Name = “TotalPower”
tp.Value = strength.Value + psp.Value + End.Value

local quest = Instance.new(“IntValue”, player)
quest.Name = “questNum”
quest.Value = 0

local str4Q = Instance.new(“NumberValue”, player)
str4Q.Name = “str4Q”
str4Q.Value = 0

local hasClickedQuest = Instance.new(“BoolValue”, player)
hasClickedQuest.Name = “hasClickedQuest”
hasClickedQuest.Value = false

local safe = Instance.new(“BoolValue”, player)
safe.Name = “Safe”
safe.Value = true

local powers = Instance.new(“Folder”, player)
powers.Name = “Powers”

local hasAura = Instance.new(“BoolValue”, powers)
hasAura.Name = “hasAura”
hasAura.Value = false

local hasFly = Instance.new(“BoolValue”, powers)
hasFly.Name = “hasFly”
hasFly.Value = false

local hasEnergyPunch = Instance.new(“BoolValue”, powers)
hasEnergyPunch.Name = “hasEnergyPunch”
hasEnergyPunch.Value = true

local hasInvisiblity = Instance.new(“BoolValue”, powers)
hasInvisiblity.Name = “hasInvisiblity”
hasInvisiblity.Value = false

local hasInvisible = Instance.new(“BoolValue”, player)
hasInvisible.Name = “isInvisible”
hasInvisible.Value = false

local questInfo = Instance.new(“Folder”, player)
questInfo.Name = “QuestInfo”

local questTargetStat = Instance.new(“StringValue”, questInfo)
questTargetStat.Name =“Stat”
questTargetStat.Value = “None”

local questTargetVal = Instance.new(“NumberValue”, questInfo)
questTargetVal.Name =“Value”
questTargetVal.Value = 0

local redeemedCodes = Instance.new(“StringValue”, player)
redeemedCodes.Name = “RedeemedCodes”
redeemedCodes.Value = “”

strength.Changed:Connect(function()
tp.Value = strength.Value + psp.Value + End.Value
end)

psp.Changed:Connect(function()
tp.Value = strength.Value + psp.Value + End.Value
end)

End.Changed:Connect(function()
tp.Value = strength.Value + psp.Value + End.Value
end)
Rep.Changed:Connect(function()
if Rep.Value == 0 then
elseif Rep.Value >= 5 and Rep.Value < 10 then
Title.Value = “Savior”
elseif Rep.Value >= 15 and Rep.Value < 30 then
Title.Value = “Guardian”
elseif Rep.Value >= 30 and Rep.Value < 70 then
Title.Value = “Officer”
elseif Rep.Value >= 70 and Rep.Value < 125 then
Title.Value = “Angel”
elseif Rep.Value >= 125 and Rep.Value < 150 then
Title.Value = “Defender”
elseif Rep.Value >= 150 then
Title.Value = “Superhero”
elseif Rep.Value <= -5 and Rep.Value > -10 then
Title.Value = “Evil”
elseif Rep.Value <= -15 and Rep.Value > -30 then
Title.Value = “Demon”
elseif Rep.Value <= -30 and Rep.Value > -70 then
Title.Value = “Criminal”
elseif Rep.Value <= -70 and Rep.Value > -125 then
Title.Value = “Crook”
elseif Rep.Value <= -125 and Rep.Value > -150 then
Title.Value = “Assassin”
elseif Rep.Value <= -150 then
Title.Value = “Supervillian”
end
end)

if player.Name == “Lamino961” then
player.Chatted:Connect(function(msg)
if msg == “/admin” then
if player.PlayerGui:FindFirstChild(“AdminPanel”) then
player.PlayerGui:FindFirstChild(“AdminPanel”):Destroy()
else
game.ServerStorage.AdminStuff.AdminPanel:Clone().Parent = player.PlayerGui
end
end
end)
end

local function ownsgamepass(userId, gamepassId)
local s,res = pcall(MarketPlaceService.UserOwnsGamePassAsync, MarketPlaceService, userId, gamepassId)
if not s then
res = false
end
return res
end

while wait(60) do
if ownsgamepass(player.UserId, 251310342) then
coins.Value += 1000
totalCoins.Value += 500*2
else
coins.Value += 5
totalCoins.Value += 5

	end

end
end)

1 Like

ths help to fix promblem

Workspace.Daily Reward.Coin Giver.Coin.Script:11: attempt to index nil with ‘Value’ - Server - Script:11

1 Like

currency = "Coins"	-- Change Gold to the currency you want to give
amnt = 10000					-- Change 50 to the amount of money you want to give
debounce = false		-- Don't change this

	function onTouch(hit)
		if hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == false then
			if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
			ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
			ThisPlayer.leaderstats:findFirstChild(currency).Value = ThisPlayer.leaderstats:findFirstChild(currency).Value + amnt
			script.Parent.Transparency = 1
			script.Parent.CanCollide = false
			debounce = true
			wait(86400)		-- Respawn time for the cash giver
			script.Parent.Transparency = 0
			script.Parent.CanCollide = true
			debounce = false
			end
		end
	end


script.Parent.Touched:connect(onTouch)

Does this fix the error? If not, could you tell me what’s in the output now?

currency = “Coins” – Change Gold to the currency you want to give
amnt = 10000 – Change 50 to the amount of money you want to give
debounce = false – Don’t change this

function onTouch(hit)
if hit.Parent:findFirstChild(“Humanoid”) ~= nil and debounce == false then
if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
ThisPlayer.stats:findFirstChild(currency).Value = ThisPlayer.stats:findFirstChild(currency).Value + amnt
script.Parent.Transparency = 1
script.Parent.CanCollide = false
debounce = true
wait(86400) – Respawn time for the cash giver
script.Parent.Transparency = 0
script.Parent.CanCollide = true
debounce = false
end
end
end

script.Parent.Touched:connect(onTouch)

14:12:56.425 Coins is not a valid member of Folder “Players.Lamino961.leaderstats” - Server - LeaderboardHandler:36

local CoinsLeaderboard = DataSoreService:GetOrderedDataStore("CoinsLeaderboard")

local function updateLeaderboard()
	local success, errorMessage = pcall(function()
		local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
		local CoinsPage = Data:GetCurrentPage()
		for Rank, data in ipairs(CoinsPage) do
			local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
			local Name = userName
			local Coins = data.value
			local isOnLeaderboard = false
			for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
				if v.Player.Text == Name then
					isOnLeaderboard = true
					break
				end
			end
			if Coins and isOnLeaderboard == false then
				local newLbFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
				newLbFrame.Player.Text = Name
				newLbFrame.Coins.Text = Coins
				newLbFrame.Rank.Text = "#"..Rank
				newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
				newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
			end
		end
	end)
	if not success then
		print(errorMessage)
	end
end

while true do
	for _, player in pairs(game.Players:GetPlayers()) do
		CoinsLeaderboard:SetAsync(player.UserId, player.leaderstats.Coins.Value)
	end
	
	for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
		frame:Destroy()
	end
	updateLeaderboard()
	wait(10)
end