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 7 years ago
Edited 7 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.

script.Parent.Parent.MouseButton1Click:connect(function()
    if script.Parent.Parent.Input.Text == 'CodeTest' then
        game.Players.LocalPlayer. = add 'Money' + 2500 -- Stopped here because the player didn't got the money
        script.Parent.Parent.Text = 'Success!'
        wait(0.7)
        script.Parent.Parent.Text = 'Insert Code'
        script.Parent.Parent.Input.Text = ''
    else
        script.Parent.Parent.Text = 'Invalid Code!'
        wait(0.7)
        script.Parent.Parent.Text = 'Insert Code!'
        script.Parent.Parent.Input.Text = ''
    end
end)

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:

local code1 = "TestCode"
local p = script.Parent.Parent.Parent.Parent.Parent
script.Parent.Parent.GO.MouseButton1Click:connect(function()
    if script.Parent.Text:lower() == code1:lower() then
        if p:FindFirstChild('Code'..code1) then
            script.Parent.Text = "Already Used!"
            else
        Instance.new('Model', p).Name = ("Code"..code1)
        script.Parent.Text = "Redeemed!"
        local money = game.ServerStorage:FindFirstChild("MoneyStorage"):FindFirstChild(p.Name)
        money.Value = money.Value + 250000
        end
    end
end)

Answer this question