So I have this srippt, and you enter a code into a text box and your supposed to get leaderstats from it and it doesnt work and i dont know why please somebody help this is quite urgent thank merry xmas

local box = script.Parent
local plr = game.Players.LocalPlayer
local redeemed = false

box.FocusLost:connect(function(click)
	if box.Text == "Test" and redeemed == false then
		local player = game.Players:GetPlayerByUserId(click.PlayerId)
        player.leaderstats.Bills.Value = player.leaderstats.Bills.Value + 70
		redeemed = true
		box.Text = "Code Accepted!"
		wait(1)
		box.Text = "Redeem Code"
	elseif box.Text == "Test" and redeemed == true then
		box.Text = "Already Used!"
		wait(1)
		box.Text = "Redeem Code"
	else
		box.Text = "Code Declined!"
		wait(1) 
		box.Text = "Redeem Code"
	end
end)

2 comments

0

Don't mark your posts as urgent, they usually repel users because a bug in a Roblox game is usually not very important to need immediate attention by others.

0

Also, I have marked this as non-descriptive because the OP didn't specify what part about it doesn't work and does not know a general idea of where the bug occurs.