I'm currently making a script for redeeming codes to get a knife or cash. I'm trying to execute it by testing with knife first (if I can correctly do knife, I can do cash) But when I type in the code, It won't work. Anyone got tips of how to fix this?
local player = game.Players.LocalPlayer
local shop = player.PlayerGui.ShopGUI.ShopMaster
local codepage = shop.Pages.Codes
local codebox = codepage.CodeFrame.Code
function onActivated()
if codebox.Text == "Code1" then
game.ReplicatedStorage.Knives.CodeKnife:clone().Parent = player.Backpack
end
end
codebox.Changed:connect(function(onActivated)
BTW, can I also change "onActivated" to something else that is not global?

2 comments
Works well! Thanks!
No problem