Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

help with adding a goal to a players leaderstat (?)

Asked by 2 years ago

Hey everyone,

So this block of code is trying to give a player who scores a goal 1 goal

there is a value called owner inside the ball which whenever a player touches it, the value changes to their name this script is inside a part which is in a net

so with their name im trying to find them on the players section and give them a goal

i hope that makes sense

script.Parent.Touched:Connect(function(hit)
    if hit.Name == "ball"  then
        local scorer = hit.Owner.Value
        local players = game:GetService("Players")
        players.scorer.leaderstats.Goals.Value = players.scorer.leaderstats.Goals.Value + 1
        wait(1)
    end
end)

Answer this question