local button = script.Parent.Parent
local box = button.Parent.CodeBox
local code = "Code"
local code2 = "Code2"
local code3 = "Code3"
local redeedmed = false
button.MouseButton1Click:Connect(function(plr)
if box.Text == code and redeedmed == false then
redeedmed = true
button.Text = "Success"
game.Players.LocalPlayer.Strength.Value = game.Players.LocalPlayer.Strength.Value + 50
game.Players.LocalPlayer.Money.Value = game.Players.LocalPlayer.Money.Value + 25
wait(2)
button.Text = "Submit"
return true
end
if box.Text == code2 and redeedmed == false then
redeedmed = true
button.Text = "Successfully redeemed!"
game.Players.LocalPlayer.Strength.Value = game.Players.LocalPlayer.Strength.Value + 50
game.Players.LocalPlayer.Money.Value = game.Players.LocalPlayer.Money.Value + 25
wait(2)
button.Text = "Submit"
return true
end
if box.Text == code3 and redeedmed == false then
redeedmed = true
button.Text = "Successfully redeemed!"
game.Players.LocalPlayer.Strength.Value = game.Players.LocalPlayer.Strength.Value + 50
game.Players.LocalPlayer.Money.Value = game.Players.LocalPlayer.Money.Value + 25
wait(2)
button.Text = "Submit"
return true
else
button.Text = "Invalid"
wait(2)
button.Text = "Submit"
return false
end
end)
✓ ANSWER ACCEPTED
CodeBox is not a valid member of ScreenGui Why is this happening?
1 answer
✓ Accepted answer
Did you check if your pathing was correct? If it was correct, please use WaitForChild as the TextBox may not be ready when the script runs.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Nothing worked for me but thank you Vong25