Point Give Block

I want to make a block that gives you some points. I have the leaderboard system but I was just wondering how to increase it. I have seen the dev hub but I don’t understand it, and also I don’t know how to apply it to my situation.

You could use a .Touched event and then add 1 to the points. If you want to make it give you points when you click on the block, you have to use a clickdetector.

Yes, I was wondering how to actually give the points. I know how to do the .Touched event but not how to actually add the points.

player.leaderstats.CURRENCYNAME.Value = player.leaderstats.CURRENCYNAME.Value + amount

I get this error.

player.leaderstats.ObbyOints.Value = player.leaderstats.ObbyOints.Value + 1:1: attempt to index nil with ‘leaderstats’

Show me your leaderstats script :confused: Can’t help without any script given.

local function onPlayerJoin(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local points = Instance.new("IntValue")
	points.Name = "ObbyOints"
	points.Value = 0
	points.Parent = leaderstats
 
end

game.Players.PlayerAdded:Connect(onPlayerJoin)
player:WaitForChild("leaderstats").CURRENCYNAME.Value = player:WaitForChild("leaderstats").CURRENCYNAME.Value + amount

I put it in the input window so maybe that’s why it didn’t work. I’ll try again with that script.

Make sure to adjust workspace.block to where your block is.

workspace.block.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.leaderstats.ObbyOints.Value += 1
end
end)

And sorry for my identing, I’m on mobile :slightly_smiling_face: