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

How do I make it so when I touch a brick it adds +1 wins to the local player (in leaderstats)?

Asked by 5 years ago

I know I would use the Touched event but I don't know what to put after.

1 answer

Log in to vote
0
Answered by
chomboghai 2044 Moderation Voter Community Moderator
5 years ago

You would put exactly what you think you'd put. (At least I hope you'd think so)

Find the reference to your leaderstats object then increment the wins property, if you have one set. I'm not sure exactly how you structured it but if you are counting wins using an IntValue, then you would have to reference that object and increment it.

local part = script.Parent
part.Touched:Connect(function(touchedPart)
    -- [[ --
    get player of touchedPart
    find wins (IntValue) for that player
    wins.Value = wins.Value + 1
    -- ]] --
)

That's the basic idea of what you'd do. I would need to see more of how you did your leaderstats to give you a more specific example, but I hope this helps.

Ad

Answer this question