Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix this Gui script?

Asked by 10 years ago
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.

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. Tempestatem 884 — 10y
0
Unfortunately your answers didn't help. Thank you for responding though. SamDomino 65 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

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

Ad
Log in to vote
0
Answered by 10 years ago

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

Answer this question