New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
2

Adding leaderboard points on pickup and removing on drop?

Asked by 1 year ago

(Im not asking for a script im simply asking how would I approach this/format) So, how would i make a tool that would run this code:

game.Players.LocalPlayer.leaderstats.Weight.Value = game.Players.LocalPlayer.leaderstats.Weight.Value + 10

and this code on drop:

game.Players.LocalPlayer.leaderstats.Weight.Value = game.Players.LocalPlayer.leaderstats.Weight.Value - 10

0
Are you referring to whenever a tool gets picked up and dropped? casper123123123 359 — 1y
0
yes RedDeadDevil1908 54 — 1y
0
Did my answer give you any direction on where to start? casper123123123 359 — 1y
0
you would be much better off if you created a variable for weight. User#21908 42 — 1y
0
Yeah Casper RedDeadDevil1908 54 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

Whenever you want to perform any sort of Mathematical Arithmetic on a Number you need to always set it equal to itself and then the Arithmetic. What you are trying to achieve is very easy. I recommend to first read this discussion about it . I would personally go with storing all the tools they have in a Table. Anyway's that's pretty much all the information you need really. Here are a few links you could use.

Lua Math Libraries

Tables

GetChildren

ChildRemoved

Roblox Lua Wiki

Roblox Dev Forum

PeasFactory's Scripting Tutorials ( Really useful, Learnt a lot from him)

Ad

Answer this question