I want to make my game where you get Tokens when you type in the twitter code you earn +10 tokens when you redeem it! This is in a Local Script btw! script below please help!
script.Parent.MouseButton1Click:connect(function(onClick)
if script.Parent.Parent.Input.Text == 'Code' then
function onClick(hit)
local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder
if stats ~= nil then --If moneyholder exists then
local Tokens = stats:findFirstChild("Tokens") --Get money
Tokens.Value = Tokens.Value +10 --increase amount of money by the number displayed here (500000)
end
end
script.Parent.Parent.Input.Text = 'Me'
script.Parent.Text = 'Success!'
wait(1)
script.Parent.Text = 'Submit'
else
script.Parent.Parent.Input.Text = ''
script.Parent.Text = 'Invalid Code!'
wait(1)
script.Parent.Text = 'Submit'
end
end)
