Attempt to call a string value

I currently have a script that gives the player a point if they are touching the block. When you start touching the block, in the output it says “attempt to call a string value” and doesn’t update the leaderboard. Know any fixes?

local part = script.Parent
local canGet = true

local function onTouch(otherPart)
    local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
    if humanoid then
        local player = game.Players:FindFirstChild(otherPart.Parent.Name)
        if player and canGet then
            canGet = false
		player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
            canGet = true


Change part.Touched:Connect("onTouch") to part.Touched:Connect(onTouch). By doing

local function onTouch(otherPart)

you’re defining onTouch as a variable (like local part and canGet; identical to local onTouch = function(otherPart)) and assigning your function as its value. The Connect function requires a function as an argument, not a string describing your function.

onTouch is a function, you don’t call it with a string, just remove the "" and it should fix the issue:

part.Touched:Connect(onTouch) -- as you can see, there is no ""