So i always get attempt to index nil 'whatever' and im using remote functions, this is when i fire the server
local player = game.Players.LocalPlayer
local textbox = script.Parent.Parent.TextBox
local button = script.Parent
script.Parent.MouseButton1Click:Connect(function(player)
game.ReplicatedStorage.CodeRedeem:FireServer(player, textbox, button)
end
)
and this script is when the server is fired
game.ReplicatedStorage.CodeRedeem.OnServerEvent:Connect(function(player, textbox, button)
local reward = 9000
if textbox.Text == "E" --Insert Codes here
then
print("Right Code")
button.Text = 'Redeemed!'
textbox.LocalScript.ching:Play()
wait(1)
textbox.Text = "[INSERT CODE HERE]"
game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + reward
else
print("Wrong Code")
button.Text = "Invalid Code"
textbox.LocalScript.error:Play()
wait(1)
textbox.Text = "[INSERT CODE HERE]"
end
end)

2 comments
lol why use remote function, if u want to fireserver try using remote event, heres for more info lol https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
he is using remote events though. -_-