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

i am trying to make a gui shop this is the error that keep coming up plz help?

Asked by 6 years ago
local other = script.Parent.Parent.TextButton
local CurrentOther= script.Parent.Parent.TextButton.Value.Value -- this is an int Value
script.Parent.MouseButton1Click:Connect(function()
wait(23)
other.Text = other.Text - 2344
if CurrentOther.Value < 0 then
CurrentOther.Value = 0
other.Text = 0
end
end)

and this is the error 10:38:59.149 - Players.helleric.PlayerGui.ssa.asd.LocalScript:5: attempt to -index upvalue 'CurrentOther' (a number value)

2 answers

Log in to vote
0
Answered by 6 years ago

Try this instead:

local players = game:GetService("Players")
local CurrentOther = players.LocalPlayer.PlayerGui.GUI.TextButton:FindFirstChild('Value').Value

Make sure you put the name of the "GUI", and the correct location of the "TextButton".

Also on line #6 where it says:

"if CurrentOther.Value"

Make sure you change it to just:

"If CurrentOther"

because you already got the value of the IntValue when you created the variable, "CurrentOther".

Ad
Log in to vote
0
Answered by 6 years ago

I think it should be local CurrentOther= script.Parent.Parent.TextButton.Value

And PLEASE don't name your value instances "Value" because it will create an enormous amount of confusion.

0
ok. but i try that it did not work helleric -3 — 6y

Answer this question