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

How to add money on leaderboard when typed a code? [Found out how]

Asked by 8 years ago
Edited 8 years ago

Wish to make the right code gives some money. Using Local script This is the code i'm used before for Twitter code: (Gives money) It says add is wrong.

01script.Parent.Parent.MouseButton1Click:connect(function()
02    if script.Parent.Parent.Input.Text == 'CodeTest' then
03        game.Players.LocalPlayer. = add 'Money' + 2500 -- Stopped here because the player didn't got the money
04        script.Parent.Parent.Text = 'Success!'
05        wait(0.7)
06        script.Parent.Parent.Text = 'Insert Code'
07        script.Parent.Parent.Input.Text = ''
08    else
09        script.Parent.Parent.Text = 'Invalid Code!'
10        wait(0.7)
11        script.Parent.Parent.Text = 'Insert Code!'
12        script.Parent.Parent.Input.Text = ''
13    end
14end)

It could be nice If somebody know how to let the code give me money.

Maybe the amount of money giving in the same script.

Using script for now:

01local code1 = "TestCode"
02local p = script.Parent.Parent.Parent.Parent.Parent
03script.Parent.Parent.GO.MouseButton1Click:connect(function()
04    if script.Parent.Text:lower() == code1:lower() then
05        if p:FindFirstChild('Code'..code1) then
06            script.Parent.Text = "Already Used!"
07            else
08        Instance.new('Model', p).Name = ("Code"..code1)
09        script.Parent.Text = "Redeemed!"
10        local money = game.ServerStorage:FindFirstChild("MoneyStorage"):FindFirstChild(p.Name)
11        money.Value = money.Value + 250000
12        end
13    end
14end)

Answer this question