Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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 ?

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

6 comments

0

Post your question here...

0

If i put it here no one won't answer and will ignore the thread, because they think it's "FREE MODELISH"

0

Well, are you getting any answers with your current strategy? Doesn't look like it.

0

-rep... really

0

what did i tell you... No answer... XD

1 answer

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

Try this

1 comment

0

what is this.... the script i scripted is mine not berezaa's he doesn't explain anything about removing.

This discussion is preserved as it was. New answers, comments, and votes are closed.