- These two buttons to be invisible
- 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?
- 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.
Well since this is a scripting forum you should probably post your script.
Remember to put 3 backticks before and after the script when you post it here so the formatting is correct.
How are you creating the 2nd floor buttons in your script?
can you send the values that you have in your buttons?
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)
Does the two buttons appers every time you run the game ? Is there any other buttons that appers sometimes ?
yes the 2 buttons appreas as soon as you start the game, and everything is working fine except for one button that is for the lazer door, I tried putting the dependecy on something but it deosent work and its still visible, but I let it because its ok and not that important but the 2 ones have to be invisible
I honestly can’t find the issue. I’m searching and keep trying but cannot find the bug. Are you sure that the button dependency value and the lazer door name are the same. Also on the BoughtItems folder is there any model with the same name ?
I made my own test tycoon and all work pretty well ! Are the item value of the button and the name of the lazer door are the same ?
Here a view of my tycoon :
And here the view when I run the game :
found a solution to make the 2 buttons invisible i put the dependecy for the second floor but there is a problem, when buying the second floor they can skip buying the conveyor and that shouldnt happen, but
they can still buy the conveyor
What should be the dependency of the buttons ?
the buttons dependecy should be the previous thing before it, so if they buy the previous one the button shows, example: DropperButton2 dependecy value is on the Dropper2 (the item and not the button)