Edit: This code is for a button. I have found a problem in the code before asking this question, but fixing it didn't solve it. Code:
--// OldBo5 \\--
local frame = script.Parent.Parent.Parent.codeFrame
local txt = script.Parent.Parent.codeTxt
local btn = script.Parent
local plr = game.Players.LocalPlayer
btn.MouseButton1Down:Connect(function()
if txt.Text == "testCode" and plr.hiddenleaderstats.redeemedCode1.Value == false then
btn.Text = "Enjoy."
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 100
plr.hiddenleaderstats.redeemedCode1.Value = true
wait(2)
btn.Text = "Redeem"
elseif plr.hiddenleaderstats.redeemedCode1.Value == true then
btn.Text = "Already redeemed"
wait(2)
btn.Text = "Redeem"
end
end)
I have tried: Script Analysis. Replacing plr.hiddenleaderstats.redeemedCode1 with plr.hiddenleaderstats.redeemedCode1.Value (my fault for forgetting .Value)

1 comment
add the value from the leaderstats (this code: plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 100) with an remote script if you want it server-sided