Getting error not sure why

ok I deleted the leaderboard script and it stopped saying that but I need a leaderboard script so what do I do

try using this

local obj = script.Parent
obj.ClickDetector.MouseClick:Connect(function()
print(script.Parent.Money)
script.Parent.Money.Value += 1
end)

and tell me what it prints

Can you show us the leaderboard script? We can try to modify it for you to stop deleting the value, you shouldn’t have to rewrite it.

1 Like

yes do that

this is for the character reqauirement ignore this

1 Like

I kinda already deleted it but I can redo it

You can press undo (Ctrl+Z) to “un-delete” it.

press ctrl / cmd + z

until the script is restored

I was editing some other stuff and its too far for me to redo. I’m almost finished

dang, then tell us the code when ur done remaking it

game.Players.PlayerAdded:Connect(function(player)
	
	local leaderboard = Instance.new("Folder")
	leaderboard.Name = "leaderstats"
	leaderboard.Parent = player
	
	local money = workspace.Cash.Money
	money.Name = 'Money'
	money.Parent = leaderboard
	
end)

ah, your setting the parent of money to a different place so the nmoney is in the folder not the workspace

I kinda understand what ur saying but what do I change?

remove the “money.Parent = leaderboard” part

Now it doesnt show leaderboard :confused:

mhm u can only have 1 so in the script inside cash you have to do

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
plr.leaderstats.Money.Value += 1
end)

Its actually a server script so is it the same thing just change the script.Parent part?

I still get an error with this so idk what to do (Sorry for being such a noob)

is the value a int/number value or a string value, show me the console

1 Like

Nevermind, this method would work, I need more sleep lol

Do replace your leaderboard code with this though.

game.Players.PlayerAdded:Connect(function(player)
	
	local leaderboard = Instance.new("Folder")
	leaderboard.Name = "leaderstats"
	leaderboard.Parent = player
	
	local money = Instance.new("NumberValue")
	money.Name = 'Money'
	money.Parent = leaderboard
	
end)
1 Like