Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I fix this Gui script?

function onButtonClicked(mytix,tix,ratio1,ratio2)
	local player=script.Parent
local mytix=player.TixT.Text.Value
local tix=player.TixB.Text.Value
local ratio1=player.TR.Text.Value
local ratio2=player.RR.Text.Value
local RT=player.Parent.ResultsT
	player.Visible=false
		RT.Visible=true
	RT.CT.Text.Value=("Current Tix: "..mytix.."")
local robuxgained = tix/ratio2
RT.RP.Text.Value=("Rx Profit: "..robuxgained.."")
local totaltix = robuxgained*ratio1
RT.TT.Text.Value=("End Tix Result: "..totaltix.."")
local tixgained = totaltix-mytix
RT.TP.Text.Value=("Tix Profit: "..tixgained.."")
end 
script.Parent.R.MouseButton1Click:connect(onButtonClicked)

OutPut:17:57:38.430 - Players.Player1.PlayerGui.TC.ValuesTix.Script:12: attempt to concatenate local 'mytix' (a nil value) 17:57:38.431 - Stack Begin 17:57:38.431 - Script 'Players.Player1.PlayerGui.TC.ValuesTix.Script', Line 12 17:57:38.432 - Stack End

For some reason I keep getting this error.

2 comments

0

Well, i'm not sure if it matters, but could it be that you have mytix,tix,ratio1,ratio2 at the top? Even though they were defined? I havn't dealt with that part of Lua yet.

0

Unfortunately your answers didn't help. Thank you for responding though.

2 answers

Don't use mytix, tix, ratio1, and ratio2 as arguments if you are already declaring them in the function.

Oh I figured it out.All I had to do was remove the "Values".

This discussion is preserved as it was. New answers, comments, and votes are closed.