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)

1 comment
It doesn't seem wise to add leaderstats on the client so that's probably why it won't work the way you want, merry xmas