Tycoon Dependendcy not working!

  1. These two buttons to be invisible

  2. I’m making a tycoon game and I got a problem with the dependency, the 2 buttons in the second floor are visible which they shouldn’t be, the dependency are on the first two dropper buttons on the second floor which should appear after buying the conveyor but these two buttons are already visible when you claim the tycoon everything else is working fine but these two aren’t for some reason does anyone know how to fix it?

  3. I asked help from discord which didn’t help and I haven’t found anything from devforum, but if you know a topic with the same reason then please send it.


3 Likes

q1. Isn’t Transparency property exists?

q2. Is it visible too in the studio while not play-testing?

2 Likes

a1. using the transparency on the button wont ever make it visible when buying which is something not easy for you to understand

a2. everything is visible on studio and everything start working when the game starts

2 Likes

Try changing ‘The object that must be before the button can exist’

maybe you gave these two conveyors the same name if you are storing item data in a stringValue

2 Likes

if i make the the object that must be before the button can exist it would be visible even without the floor and i dont want that to happend,

and no they are not named the same and the first one is on another folder and you cant buy it it already exists it name is Conveyorbelt and the second floor one name is Conveyorbelt2 and it can be purchased when you get to the second floor

2 Likes

There must be a code that appears the button, do you use a loop in this code?

2 Likes

Two things.

  1. A loop might be causing this error as for some reason studio HATES loops and will do anything to make you use an alternate solution. Anything. Including making bugs like these, giving ‘exhausted allowed execution time’ errors whatever that is supposed to mean, etc etc.
    (at least for me it does)
  2. Have you made sure that in the code to make the button dissapear, you have:
    a. Set canCollide to false
    b. set canTouch to false
    c. Set Transparency to 1
    and for the code that makes it appear, you have:
    a. Set canCollide to true
    b. set canTouch to true
    c. set Transparency to 0

If you haven’t, there’s your error.
If you have, it might be a problem with your RBXScriptSignal part that fires either the dissapear part of the code to late or the appear part of the code too early.

2 Likes

yes there is a code, the button should appear when the player purchase the button before it, i do use loops

1 Like
  1. yes i do use loops and i dont really know how to fix what are you talking

  2. of course this is included in my script, all the buttons are working fine exept for the two ones on the picture

and for the RBXScriptSignal i dont really know whats that

here’s the full script of the tycoon:

lua
local TycoonModel = script.Parent.Parent
local items = {}
local RepStorage = game:GetService("ReplicatedStorage")

local BoughtItems = TycoonModel:FindFirstChild("BoughtItems")
local Buttons = TycoonModel:FindFirstChild("Buttons")
local MainItems = TycoonModel:FindFirstChild("MainItems")
local DropperParts = TycoonModel:FindFirstChild("DropperParts")
local Values = TycoonModel:FindFirstChild("Values")
local Scripts = TycoonModel:FindFirstChild("Scripts")
local GamepassesValues = RepStorage:WaitForChild("GamepassesValues")
local x2MoneyVal = GamepassesValues:FindFirstChild("x2Money")
local Mps = game:GetService("MarketplaceService")
local GDid = 1538122583
local x2money = 122285430
local config = script.Parent.Parent.Configuration


local TycoonClone = TycoonModel:Clone()
TycoonClone.Parent = game.ReplicatedStorage

MainItems.OwnedDoor.MainDoor.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and Values.OwnerValue.Value == nil then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)

		if player:FindFirstChild("OwnsTycoon").Value == false then
			Values.OwnerValue.Value = player
			player:FindFirstChild("OwnsTycoon").Value = true

			while wait() do
				MainItems.OwnedDoor.MainDoor.SurfaceGui.ClaimText.Text = tostring(Values.OwnerValue.Value).." Tycoon"
				MainItems.OwnedDoor.MainDoor.Transparency = 0.5
			end
		end
	end
end)



for i, v in pairs(Buttons:GetChildren()) do
	local NewItem = BoughtItems:FindFirstChild(v.Item.Value)
	if NewItem ~= nil then
		items[NewItem.Name] = NewItem:Clone()
		NewItem:Destroy()
	else
		v.BrickParts.BrickPart1.Transparency = 1
		v.BrickParts.BrickPart2.Transparency = 1
		v.Circle.GradientCylinder.Decal1.Transparency = 1
		v.Circle.GradientCylinder.Decal2.Transparency = 1
		v.Circle.GradientCylinder.Decal3.Transparency = 1
		v.Circle.GradientCylinder.Decal4.Transparency = 1
		v.BrickParts.BrickPart1.CanCollide = false
		v.BrickParts.BrickPart2.CanCollide = false
		v.Circle.TitleGui.MoneyTitle.Visible = false
		v.Circle.TitleGui.NameTitle.Visible = false
		v.Circle.LightCore.PointLight.Brightness = 0
	end
	
	if v:FindFirstChild("Dependency") then
		coroutine.resume(coroutine.create(function()
			v.BrickParts.BrickPart1.Transparency = 1
			v.BrickParts.BrickPart2.Transparency = 1
			v.Circle.GradientCylinder.Decal1.Transparency = 1
			v.Circle.GradientCylinder.Decal2.Transparency = 1
			v.Circle.GradientCylinder.Decal3.Transparency = 1
			v.Circle.GradientCylinder.Decal4.Transparency = 1
			v.BrickParts.BrickPart1.CanCollide = false
			v.BrickParts.BrickPart2.CanCollide = false
			v.Circle.TitleGui.MoneyTitle.Visible = false
			v.Circle.TitleGui.NameTitle.Visible = false
			v.Circle.LightCore.PointLight.Brightness = 0
			if BoughtItems:WaitForChild(v.Dependency.Value, 100000) then
				v.BrickParts.BrickPart1.Transparency = 0
				v.BrickParts.BrickPart2.Transparency = 0
				v.Circle.GradientCylinder.Decal1.Transparency = 0.2
				v.Circle.GradientCylinder.Decal2.Transparency = 0.2
				v.Circle.GradientCylinder.Decal3.Transparency = 0.2
				v.Circle.GradientCylinder.Decal4.Transparency = 0.2
				v.BrickParts.BrickPart1.CanCollide = true
				v.BrickParts.BrickPart2.CanCollide = true
				v.Circle.TitleGui.MoneyTitle.Visible = true
				v.Circle.TitleGui.NameTitle.Visible = true
				v.Circle.LightCore.PointLight.Brightness = 2
			end
		end))
	end
	
	v.BuyPart.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			if Values.OwnerValue.Value == player then
				if v.BrickParts.BrickPart1.Transparency == 0 and v.BrickParts.BrickPart1.CanCollide == true and v:FindFirstChild("Price") then
					if player:WaitForChild("leaderstats"):FindFirstChild("Money").Value >= v.Price.Value then
						player.leaderstats.Money.Value -= v.Price.Value
						items[v.Item.Value].Parent = BoughtItems
						v:Destroy()
					end
				elseif v:FindFirstChild("RPrice") then
					Mps:PromptProductPurchase(player, GDid)
					Mps.ProcessReceipt = function(reciptInfo)
						local plr = game.Players:GetPlayerByUserId(reciptInfo.PlayerId)
						if reciptInfo.ProductId == GDid then
							items[v.Item.Value].Parent = BoughtItems
							v:Destroy()
							return Enum.ProductPurchaseDecision.NotProcessedYet
						end
					end
				end
			end
		end
	end)
end


local Debounce = false

MainItems.MoneyCollector.CollectMoney.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if Values.OwnerValue.Value == player then
			if Debounce == false then
				Debounce = true

				local MoneyMulty = player:WaitForChild("RebValues"):FindFirstChild("MoneyMulty")
				player:WaitForChild("leaderstats"):FindFirstChild("Money").Value += Values.MoneyValue.Value * MoneyMulty.Value * x2MoneyVal.Value
				wait()
				Values.MoneyValue.Value = 0
				wait(1)
				Debounce = false

			end
		end
	end
end)
1 Like