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

I have a problem with variables, any answers?(Need this answered soon!)

Asked by 10 years ago

I have a problem with gui not counting as a member of a frame. I have a program that is supposed to change the text on a button, called "ShopButton1" and the output says it is not a member of "Frame". Typically, i fix this problem by making them a global variable in a separate script handling global variables. but this time, it's not working, no matter what, can anyone answer this?

button = script.Parent
sb1 = script.Parent.Parent.ShopButton1
sb2 = script.Parent.Parent.ShopButton2
sb3 = script.Parent.Parent.ShopButton3
function clicked()
    _G.info.Text = "  "
sb1.Visible = true
sb1.knife.Active = false
sb1.guns.Active = false
sb1.money.Active = true
sb1.Text = "Money Level 1: Gives you *100, this can pay for two teleportation's, or one crude knife. Price: 2R$"
sb2.Visible = true
sb2.knife.Active = false
sb2.guns.Active = false
sb2.money.Active = true
sb2.Text = "Money Level 2: Gives you *250, this can pay for a few teleportation's, or 2/3 for a Trench Knife. Price: 4R$"
sb3.Visible = true
sb3.knife.Active = false
sb3.guns.Active = false
sb3.money.Active = true
sb3.Text = "Money Level 3: Gives you *600, this can pay for many teleportation's, or a bit more than half of a Laser knife. Price: 9R$"
end
button.MouseButton1Down:connect(clicked)
0
Global variables shouldn't be necessary. Could you please post your code, and also indicate what the hierarchy of relevant objects is? BlueTaslem 18071 — 10y
0
The code shouldn't be necessary, it is very straight forward, and it is basically just Frame>ShopButton1 that is all it is, but in any script in frame, trying to call "ShopButton1" it says "ShopButton1 is not a member of "Frame"" rollercoaster57 65 — 10y
0
You probably have a typo or misunderstanding; the code is necessary for anyone to actually help you. This isn't a random bug in ROBLOX, it's a problem with what you've done. BlueTaslem 18071 — 10y
0
Okay, but there is nothing wrong with the code. rollercoaster57 65 — 10y

Answer this question