I'm making a simulator game and i made a redeem code script and i want it to change after a code is redeemed.

while wait() do
	if script.Parent.Text == "cod3" and game.Players.LocalPlayer.Code.Value == false then
		workspace.Events.Code:FireServer()
		script.Disabled = true
	end
end

The text should change to "Code redeemed!" It's a localscript.

4 comments

0

Show code for your function connecting the OnServerEvent event

0

script.Code.OnServerEvent:Connect(function(plr) plr.Code.Value = true plr.leaderstats.Clicks.Value = plr.leaderstats.Clicks.Value +25 print("Code Redeemed!")

0

You should use a RemoteFunction which returns a boolean. Check if the redeem code is valid server-side, if it returns true: change script.Parent.Text accordingly.

0

I dont know what you mean but I will try to help: textbox.Text="text here"