Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tycoon remove script problem?

Asked by
Bulvyte 388 Moderation Voter
8 years ago

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

0
Post your question here... Perci1 4988 — 8y
0
If i put it here no one won't answer and will ignore the thread, because they think it's "FREE MODELISH" Bulvyte 388 — 8y
0
Well, are you getting any answers with your current strategy? Doesn't look like it. Perci1 4988 — 8y
View all comments (2 more)
0
-rep... really Bulvyte 388 — 8y
0
what did i tell you... No answer... XD Bulvyte 388 — 8y

1 answer

Log in to vote
-3
Answered by
hiccup111 231 Moderation Voter
8 years ago

I haven't read this post, but maybe a video can help you out.

Try this

0
what is this.... the script i scripted is mine not berezaa's he doesn't explain anything about removing. Bulvyte 388 — 8y
Ad

Answer this question