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

How do I add a amount displayed in a value to leaderstats?

Asked by
Foridex 46
7 years ago

There is a value that is displayed on a money printer.

https://imgur.com/a/Qtw1P - Picture

That value is increased over time and the money is displayed every 3 seconds.

https://www.youtube.com/watch?v=wVr-INVnQsw&feature=youtu.be - Example Video

I want to add that value to Leaderstats value in the Local Player so they get more money upon clicking "Collect"

In a localscript in the "Collect" button, this is displayed but it does not function:

repeat wait() until game:GetService("Players").LocalPlayer
local stats = game.Players.LocalPlayer.leaderstats.Value

script.Parent.MouseButton1Click:connect(function(player)
    stats = stats + script.Parent.Parent.Amount.Value.Value
end)

How do i grab the leaderstats in the local player and add whats in the value to the leaderboard?

0
You don't require to wait for the player, as the script'll fire when the player loads. (Not counting the player's Character, PlayerGui, Backpack, etc.) Could you please explain more in-depth about what you're trying to accomplish? TheeDeathCaster 2368 — 7y
0
Doesnt work. Foridex 46 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Well you can’t do an adition with a NumberValue you have to do an addition of the NumberValues value. I suggest adding an extra .Value to local stats and see if that works. I am having trouble understanding your question so write back to me if this doesent work with a better explanation.

0
I do not fully understand what you mean. Leaderstats is a NumberValue in the Local Player. The value in the numbervalue is transferred to the leaderboard displaying how much money the player has. There's a NumberValue in the amount of money that's displayed on the printer. I want to add that amount in the number value to leaderstats. Foridex 46 — 7y
0
Badically you are multiplying something that you cannot multiply. When multyplying a value you do (Name Of Vale).Value FruitPuunch 0 — 7y
0
That's what i'm doing. Leaderstats is the name of the value im adding to. Foridex 46 — 7y
Ad

Answer this question