Leaderstats Error {CLOSED}

Salutations. I am having issues with adding a point to the local player’s stats once they’ve touched a part.
I may just be really unintelligent or I may just have made a few mistakes. I’m just starting out in programming so I do expect quite a few errors within the script but what’s made me really puzzled is the fact that output doesn’t present me any errors.
I hope someone will resolve this error!
The script is written in a local script and the parent of the script is the part I want touched. I may have gotten a directory wrong or some sort of common error but if I did, it would usually give me the error in output.

script.Parent.Touched:Connect(function(hit)
    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
    if player then
        player.leaderstats.Strettos.Value = player.leaderstats.Strettos.Value + 1
    end
end)

That’s the script that is in the part. I have referenced it off a few forum posts and used the forum posts to help me.

I hope to find a solution soon! Thanks a lot!

2 Likes

Try having that exact script in a server script

1 Like

Alright, I’ll see how it goes.

1 Like

Aye, don’t put it in a local script since they cannot directly affect the server due to roblox’s FE update. Putting this in a server script as @maxen2031suggested should work perfectly!

2 Likes

Handle this with a Serverscript, you can’t replicate stuff from local script onto the server.

2 Likes

Thanks. Putting it in a ServerScript has resolved the issue! This post may now be closed.

1 Like