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

Script isnt working even though no errors in output, what is wrong?

Asked by 8 years ago

So heres what the script is sapose to do, you buy an they item by clicking on the button, it takes away 10 cash, then changes an textlabels text to true

I tried to test it on play mode, it it takes away money but it dosent change the text label text

I have a diagram of the heirarchy of the items, The textlabel is in the gui called Shop

Please tell me what the problem is c;

Image1 --> http://prntscr.com/9upeja Image2 --> http://prntscr.com/9upezl Image3 --> http://prntscr.com/9ur7w9

Anything that helps is appreciated








Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Cash function onClick() local Item = script.Parent.Parent.Parent.Parent.Inventory.Background3.Frame.Item.HasBought if Cash.Value >= 10 then Cash.Value = Cash.Value - 10 wait(.2) script.Parent.Parent.Parent.Parent.Inventory.Background3.Frame.Item.HasBought.Text = "True" end end script.Parent.MouseButton1Click:connect(onClick)
0
I could easily help you with that.... If I wasn't using an iPad because your 'hierarchy' isn't accessible on iPad but, I am quiet good at GUIs and I guess now I have to wait till I get home to look at what your 'hierarchy' is.... KingLoneCat 2642 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

1) The MouseButton1Down event only works in LocalScripts, so I'd change that 2) You seem to be a Parent short on your "Cash" variable, I'd recommend revising that.

IRRELEVANT, QUESTION WAS EDITTED

Ad

Answer this question