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

Tycoons - Invisible buttons?

As I've seen in many Tycoon games, many tycoon creators have actually managed to make a tycoon kit that has hidden buttons that appear after you buy something, but they never release it to the public! I've been trying to make a tycoon with that for a long time and have had to success at all. I've tried putting the button in the model that the previous button generates and edited the variables a bit. It would error and say the model is nil. I've tried making the button transparent and then do it...but nothing would happen. Not even any output! So I tried the first idea again and edited the wait time and it did the same as the second...? Here's my Tycoon button:

--lightpower26
--Some of these variables just make it easier for me to create my tycoon.
main = script.Parent.Parent
owner = main.Owner
button = script.Parent
name = "Walls"
price = 100
model = main:FindFirstChild("Walls")
normalname = "Purchase "..name.." for $"..price
text = button.BillboardGui.TextLabel
text.Text = normalname
backup = model:Clone()
Debounce = false
wait(1)
model:Destroy()

button.Click.MouseHoverEnter:connect(function(plr)
	if plr.Name ~= owner.Value then return end
	if plr.leaderstats.Cash.Value >= price then
		text.TextColor3 = Color3.new(0, 1, 0)
		text.TextStrokeColor3 = Color3.new(1, 1, 1)
		text.Text = "Click to "..normalname
	elseif plr.leaderstats.Cash.Value < price then
		text.Text = "You need "..(price - plr.leaderstats.Cash.Value).." more Cash to purchase "..name.."!"
		text.TextColor3 = Color3.new(1, 0, 0)
		text.TextStrokeColor3 = Color3.new(1, 1, 1)
	end
end)

button.Click.MouseHoverLeave:connect(function(plr)
	if plr.Name ~= owner.Value then return end
	text.Text = normalname
	text.TextColor3 = Color3.new(1, 1, 1)
	text.TextStrokeColor3 = Color3.new(0, 0, 0)
end)

button.Click.MouseClick:connect(function(plr)
	if button.Transparency >= 0 then
		if not Debounce then
			if plr.Name ~= owner.Value then 
				Debounce = true
				if owner.Value ~= "" then
					text.Text = owner.Value.." owns this mine! Not you!"
				elseif owner.Value == "" then
					text.Text = "No one owns this mine!"
				end
				text.TextColor3 = Color3.new(1, 0, 0)
				text.TextStrokeColor3 = Color3.new(1, 1, 1)
				delay(0.5, function()
					text.Text = normalname
					text.TextColor3 = Color3.new(1, 1, 1)
					text.TextStrokeColor3 = Color3.new(0, 0, 0)
				end)
				wait(0.5)
				Debounce = false
				return
			end
			if plr.leaderstats.Cash.Value < price then
				Debounce = true 
				text.Text = "You need "..(price - plr.leaderstats.Cash.Value).." more Cash to purchase "..name.."!"
				text.TextColor3 = Color3.new(1, 0, 0)
				text.TextStrokeColor3 = Color3.new(1, 1, 1)
				delay(0.5, function()
					text.Text = normalname
					text.TextColor3 = Color3.new(1, 1, 1)
					text.TextStrokeColor3 = Color3.new(0, 0, 0)
				end)
				wait(0.5)
				Debounce = false
				return
			end
			Debounce = true
			plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value-price
			text.Text = "Purchasing..."
			text.TextColor3 = Color3.new(0, 0, 1)
			text.TextStrokeColor3 = Color3.new(1, 1, 1)
			model = backup:Clone()
			model.Parent = main
			for i = 0, 1, 0.05 do
				text.TextTransparency = i
				text.TextStrokeTransparency = i
				button.Transparency = i
				wait()
			end
			
			game.ReplicatedStorage.ChatEvent:FireClient(plr, plr, "You have succesfully purchased "..normalname.."!")
			wait(0.1)
			Debounce = false
			button:Destroy()
		end
	end
end)

Please help me! I've looked all over the internet and roblox forums (which no one looks at my posts...) for an answer!

2 comments

0

The script you provided is totally unrelated to your question. We can help you if you want to fix your failed scripts (by the way, check if it's disabled), but also isolate the problem as much you can and leave out unrealted code. You'll get an answer faster that way.

0

The script is my tycoon button...it isn't unrelated...I even motioned that.

2 answers

What I would do when making a tycoon such as this is have all the buttons pre-made with the correct positioning but not part of any model. Instead I would put all the buttons that will be unlocked into serverstorage or lighting as this will make it so that they are still accessible from the game, but not in the workspace. Then when you unlock them, you change their parent to Workspace or whatever model you want them to be a part of. For future reference, while I am happy to answer questions such as these where you don't know how to do something, this kind of question is not really related to scripting.

Here, this Tycoon Kit has what you are looking for. I am using it to build my own tycoon and in my opinion it is the perfect starter kit.

2 comments

0

That doesn't have invisible buttons...

0

Yes it does, read the ">TUTORIAL - READ ME<" script, it's located under the "DEPENDENCIES" section.

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