function money(amount) print('plz') plr:WaitForChild("Zeni").Value = plr.Zeni.Value + amount end function power(amountt) print("working?") plr:WaitForChild("Stats"):WaitForChild("Strength").Value = plr.Stats.Strength.Value + amountt print('strength+') end plr = game.Players.LocalPlayer Input = script.Parent.Parent.CodeInput Enter = script.Parent codes = { ["Release!"] = money(1000000), ["Beta!"] = power(5000000), ["ITS OVER 9000!!!"] = power(9000) } Enter.MouseButton1Click:Connect(function() local test = codes[Input.Text] print(test.." this is it!")--says you can't concatenate nil if test then print('Valid')--doesn't print test() else print("Not")--does print end end)
Also when I join my value goes up by 5000000 and also when I die it goes up by 5000000.
I know you fixed this but I'll post my answer which probably won't work here anyways..
To fix this, you just need to remove () from the functions, and instead put the arguments when you call them.
Like this:
function money(amount) print('plz') plr:WaitForChild("Zeni").Value = plr.Zeni.Value + amount end function power(amountt) print("working?") plr:WaitForChild("Stats"):WaitForChild("Strength").Value = plr.Stats.Strength.Value + amountt print('strength+') end plr = game.Players.LocalPlayer Input = script.Parent.Parent.CodeInput Enter = script.Parent codes = { ["Release!"] = {money, 1000000}, -- remove and replace ["Beta!"] = {power, 5000000}, ["ITS OVER 9000!!!"] = {power. 9000} } Enter.MouseButton1Click:Connect(function() local test = codes[Input.Text] print(test.." this is it!")--says you can't concatenate nil if test then print('Valid')--doesn't print test[1](test[2]) else print("Not")--does print end end)