so recently im making a code redeem section, cant work

Problem: it prints out "Invalid or error" when ever i typed in the right code and pressed redeem

here is the script:

local script:

local chosenplr = game.Players.LocalPlayer
local Buttons = script.Parent.Frame
local arg2 = script.Parent.Frame.lol
local Name = Buttons.Name





script.Parent.Frame.TextButton.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Codepanel:FireServer(Buttons,{['arg1']=arg2})
	print("fired server")
end)

server script:


game.ReplicatedStorage.Codepanel.OnServerEvent:Connect(function(plr,action,Args)
	if action.Name == "Frame" then
		if Args['arg1'].Text == "test" then
			if plr.Stats.CodeTest.Value == false then
				print("detected Code Label")
				print("Code detected, now giving rewards...")
				plr.Stats.Cash.Value = plr.Stats.Cash.Value + 69420
				wait(0.01)
				print("Redeemtion success")
				plr.Stats.CodeTest.Value = true
			else
				print("redeemed before")
			end
		else
			print("invalid or error")
		end
	end
end)

btw thanks to @Harry_TheKing1 for teaching me on how to create remote events on my last question

Special thanks to all of you if you could help!

3 comments

0

Um are you sure the two hyphens on the 10th line (marking the line as a comment) are intended ?

0

oops

0

but it still dosent work