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

Is There A Bug In My Shop Gui?

My store gui does not work when I click to buy the item. Here is the script:

player = script.Parent.Parent.Parent.Parent.Parent
kills = player.leaderstats.Knockouts
Item = game.ReplicatedStorage.SpeedCoil

function buy()
if kills.Value >= 8 then

	kills.Value = kills.Value - 0

        Item:clone().Parent = player.Backpack

	wait(2)
else
        script.Parent.Text = "Not Enough Funds" 
	wait(3)
        script.Parent.Text = "Speed Coil"
end
end

script.Parent.MouseButton1Down:connect(buy)

3 comments

0

Do you have a output?

0

No

0

Wait, see the problem. It's MouseButton1Click, MouseButton1Down means you must hold the button down for a prolonged period of time before it may activate.

2 answers

Possible diagnostics:

  • not in a LocalScript
  • Active property of the Gui object is false
  • Gui object is not a button

2 comments

0

Try to check these, maybe it work then.

0
  1. I do not think it will matter much. 2) I have a button at my place that is active, and it works. 3) I went to his place and it is a button.

I tried to make a different one an had no luck, no errors or even outputs were given. Whats wrong here?

Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.KOs

function onClick()
	if Cash.Value >= 8 then
		Cash.Value = Cash.Value - 0
			local item = game.ServerStorage.SpeedCoil:clone()
			item.Parent = script.Parent.Parent.Parent.Parent.Parent.StarterGear
			item.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
			print("Yay")
	else
		script.Parent.Text = 'Nope'
		wait(3)
		script.Parent.Text = 'Speed Coil'
		print("Yay?")
	end
end

script.Parent.MouseButton1Click:connect(onClick)

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