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

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

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)







1 comment

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....

1 answer

  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

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