Hello everyone, I have problem with button to tycoon. I created new button, but i added 2 parts and decal. Decal and second part won't remove/disappear. I tried to add in script lines, which should remove them, but don't work.
Here is long script: (It's from berezaa tycoon kit)
script.Parent:WaitForChild("Buttons") for i,v in pairs(script.Parent.Buttons:GetChildren()) do if v:FindFirstChild("Head") then local object = script.Parent.Purchases:FindFirstChild(v.Object.Value) if object ~= nil then objects[object.Name] = object:Clone() object:Destroy() else print("Button: "..v.Name.." is missing its object and has been removed.") v.Head.CanCollide = false v.Head.Transparency = 1 v.Head.Decal.Transparency = 1 v.T.CanCollide = false v.T.Transparency = 1 end if v:FindFirstChild("Dependency") then v.Head.CanCollide = false v.Head.Transparency = 1 coroutine.resume(coroutine.create(function() if script.Parent.PurchasedObjects:WaitForChild(v.Dependency.Value) then if v:FindFirstChild("RequiredGamepass") then local tycoonOwner = script.Parent.Owner.Value if tycoonOwner then if game.GamePassService:PlayerHasPass(tycoonOwner,v.RequiredGamepass.Value) then if config.ButtonFadeInDependency.Value == true then for i=1,20 do wait(config.ButtonFadeInTime.Value/20) v.Head.Transparency = v.Head.Transparency - 0.05 end end v.Head.CanCollide = true v.Head.Transparency = 0 v.Head.Decal.Transparency = 1 v.T.CanCollide = false v.T.Transparency = 1 end end elseif v:FindFirstChild("BadgeNeeded") then local tycoonOwner = script.Parent.Owner.Value if tycoonOwner then if game.BadgeService:UserHasBadge(tycoonOwner.userId,v.BadgeNeeded.Value) then if config.ButtonFadeInDependency.Value == true then for i=1,20 do wait(config.ButtonFadeInTime.Value/20) v.Head.Transparency = v.Head.Transparency - 0.05 end end v.Head.CanCollide = true v.Head.Transparency = 0 v.Head.Decal.Transparency = 1 v.T.CanCollide = false v.T.Transparency = 1 end end elseif v:FindFirstChild("RequiredGroup") then local tycoonOwner = script.Parent.Owner.Value if tycoonOwner then if tycoonOwner:IsInGroup(v.RequiredGroup.Value) then if config.ButtonFadeInDependency.Value == true then for i=1,20 do wait(config.ButtonFadeInTime.Value/20) v.Head.Transparency = v.Head.Transparency - 0.05 end end v.Head.CanCollide = true v.Head.Transparency = 0 v.Head.Decal.Transparency = 1 v.T.CanCollide = false v.T.Transparency = 1 end end else if config.ButtonFadeInDependency.Value == true then for i=1,20 do wait(config.ButtonFadeInTime.Value/20) v.Head.Transparency = v.Head.Transparency - 0.05 end end v.Head.CanCollide = true v.Head.Transparency = 0 v.Head.Decal.Transparency = 1 v.T.CanCollide = false v.T.Transparency = 1 end end end)) end v.Head.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if v.Head.CanCollide == true then if player ~= nil then if script.Parent.Owner.Value == player then if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Humanoid.Health > 0 then local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) if cashmoney ~= nil then if cashmoney.Value >= v.Price.Value then cashmoney.Value = cashmoney.Value - v.Price.Value objects[v.Object.Value].Parent = script.Parent.PurchasedObjects if config.ButtonExplodeOnBuy.Value == true then local explosion = Instance.new("Explosion",workspace) explosion.Position = v.Head.Position explosion.DestroyJointRadiusPercent = 0 explosion.BlastPressure = 0 end if config.ButtonFadeOutOnBuy.Value == true then v.Head.CanCollide = false coroutine.resume(coroutine.create(function() for i=1,20 do wait(config.ButtonFadeOutTime.Value/20) v.Head.Transparency = v.Head.Transparency + 0.05 end end)) else v.Head.CanCollide = false v.Head.Transparency = 1 v.Head.Decal.Transparency = 1 v.T.CanCollide = false v.T.Transparency = 1 end end end end end end end end end) end end