Tycoon remove script problem?
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 ?
01 | BuySound = game.Players.LocalPlayer |
04 | config = script.Parent.Parent.Parent.Configuration |
07 | script.Parent:WaitForChild( "ButtonsRemove" ) |
08 | for i,v in pairs (script.Parent.ButtonsRemove:GetChildren()) do |
09 | if v:FindFirstChild( "Head" ) then |
11 | local object = script.Parent.Removes:FindFirstChild(v.Object.Value) |
15 | if v:FindFirstChild( "Dependency" ) then |
16 | v.Head.CanCollide = false |
17 | v.Head.Transparency = 1 |
18 | coroutine.resume(coroutine.create( function () |
19 | if script.Parent.RemovedObjects:WaitForChild(v.Dependency.Value) then |
20 | if config.ButtonFadeInDependency.Value = = true then |
22 | wait(config.ButtonFadeInTime.Value/ 20 ) |
23 | v.Head.Transparency = v.Head.Transparency - 0.05 |
26 | v.Head.CanCollide = true |
27 | v.Head.Transparency = 0 |
32 | if v:FindFirstChild( "Dependency2" ) then |
33 | v.Head.CanCollide = false |
34 | v.Head.Transparency = 1 |
35 | coroutine.resume(coroutine.create( function () |
36 | if script.Parent.PurchasedObjects:WaitForChild(v.Dependency 2. Value) then |
37 | if config.ButtonFadeInDependency.Value = = true then |
39 | wait(config.ButtonFadeInTime.Value/ 20 ) |
40 | v.Head.Transparency = v.Head.Transparency - 0.05 |
43 | v.Head.CanCollide = true |
44 | v.Head.Transparency = 0 |
49 | v.Head.Touched:connect( function (hit) |
50 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
51 | if v.Head.CanCollide = = true then |
53 | if script.Parent.Owner.Value = = player then |
54 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
55 | if hit.Parent.Humanoid.Health > 0 then |
56 | local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) |
57 | if cashmoney ~ = nil then |
58 | if cashmoney.Value > = v.Price.Value then |
59 | cashmoney.Value = cashmoney.Value - v.Price.Value |
60 | object.Part.Transparency = 1 |
61 | object.Part.CanCollide = false |
62 | object.Parent = script.Parent.RemovedObjects |
63 | player.BuySound:Play() |
64 | if config.ButtonExplodeOnBuy.Value = = true then |
65 | local explosion = Instance.new( "Explosion" ,workspace) |
66 | explosion.Position = v.Head.Position |
67 | explosion.DestroyJointRadiusPercent = 0 |
68 | explosion.BlastPressure = 0 |
70 | if config.ButtonFadeOutOnBuy.Value = = true then |
71 | v.Head.CanCollide = false |
72 | coroutine.resume(coroutine.create( function () |
74 | wait(config.ButtonFadeOutTime.Value/ 20 ) |
75 | v.Head.Transparency = v.Head.Transparency + 0.05 |
79 | v.Head.CanCollide = false |
80 | v.Head.Transparency = 1 |
this script is too long so paste it in ur roblox script, then read it