The thing is the script makes the button remove 1 part only in its model but not all of it's parts. So how do i make it remove all of it's children in the model instead of 1 ?
BuySound = game.Players.LocalPlayer objects = {} config = script.Parent.Parent.Parent.Configuration wait(1) script.Parent:WaitForChild("ButtonsRemove") for i,v in pairs(script.Parent.ButtonsRemove:GetChildren()) do if v:FindFirstChild("Head") then local object = script.Parent.Removes:FindFirstChild(v.Object.Value) if object ~= nil then end if v:FindFirstChild("Dependency") then v.Head.CanCollide = false v.Head.Transparency = 1 coroutine.resume(coroutine.create(function() if script.Parent.RemovedObjects:WaitForChild(v.Dependency.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 end end)) end if v:FindFirstChild("Dependency2") then v.Head.CanCollide = false v.Head.Transparency = 1 coroutine.resume(coroutine.create(function() if script.Parent.PurchasedObjects:WaitForChild(v.Dependency2.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 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 object.Part.Transparency = 1 object.Part.CanCollide = false object.Parent = script.Parent.RemovedObjects player.BuySound:Play() 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 end end end end end end end end end) end end
this script is too long so paste it in ur roblox script, then read it