local ButtonModel = script.Parent local Object = ButtonModel.Object local Cost = ButtonModel.Cost local Dependency = ButtonModel.Dependency local Button = ButtonModel.Head local Text = Button.BillboardGui.TextLabel Text.Text = Object.Value.Name.." - "..tostring(Cost.Value).."€" if Dependency.Value == "None" then for i,v in pairs(Object.Value:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 1 v.CanCollide = false elseif v:IsA("TextLabel") then v.TextTransparency = 1 end end else for i,v in pairs(ButtonModel:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 1 v.CanCollide = false elseif v:IsA("TextLabel") then v.TextTransparency = 1 end end for i,v in pairs(Object.Value:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 1 v.CanCollide = false elseif v:IsA("TextLabel") then v.TextTransparency = 1 end end if workspace.Buyed:FindFirstChild(Dependency.Value) then for i,v in pairs(ButtonModel:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 0 v.CanCollide = true elseif v:IsA("TextLabel") then v.TextTransparency = 0 end end end end Button.Touched:Connect(function(Hit) if Hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(Hit.Parent) local Cash = player.leaderstats.Euro if Cash.Value >= Cost.Value then Cash.Value = Cash.Value + Cost.Value for i,v in pairs(Object.Value:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 0 v.CanCollide = true elseif v:IsA("TextLabel") then v.TextTransparency = 0 end end for i,v in pairs(ButtonModel:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 1 v.CanCollide = false elseif v:IsA("TextLabel") then v.TextTransparency = 1 end end ButtonModel.Parent = workspace.Buyed end end end)
Don't be scared it's looking kinda hard but it's just simple script :D ok so If dependency is something other it's automaticly diseapers
What's the issue here - like what is not working properly for you and you want to fix? I'm assuming you don't want the button to disappear? Transparency 1 = invisible, transparency 0 = visible, anything inbetween is transparent.