Basically, what this script does is, when i click the block that has the script in it, it shrinks, fades, then disappears. Why wont this script work when i put more than one block in the game? How can i fix this?
local p=game.Workspace.Dirt p.Anchored=true script.Parent.ClickDetector.MouseClick:connect(function() p.ClickDetector:destroy() p.Anchored=false p.Size=Vector3.new(8,7,8) wait(1) p.Size=Vector3.new(7,6,7) wait(1) p.Size=Vector3.new(6,5,6) wait(1) p.Size=Vector3.new(5,4,5) wait(1) p.Size=Vector3.new(4,3,4) wait(1) p.Size=Vector3.new(3,2,3) wait(1) p.Size=Vector3.new(2,1,2) wait(0.0001) local d = game.Workspace.Dirt d.Transparency = 0 wait(0.1) d.Transparency = 0.1 wait(0.1) d.Transparency = 0.2 wait(0.1) d.Transparency = 0.3 wait(0.1) d.Transparency = 0.4 wait(0.1) d.Transparency = 0.5 wait(0.1) d.Transparency = 0.6 wait(0.1) d.Transparency = 0.7 wait(0.1) d.Transparency = 0.8 wait(0.1) d.Transparency = 0.9 wait(0.1) d.Transparency = 1 d:destroy() end)
First of all you should be using for loops for all of this. Second change the script so used script.Parent instead of a specific part.
Just put this in the part with a ClickDetector.
local Part = script.Parent Part.ClickDetector.MouseClick:connect(function() for i=1,7 do local P = Part.Size Part.Size = Vector3.new(P.x-1,P.y-1,P.z-1) wait(1) end for i=0,1,0.1 do Part.Transparency = i wait(0.1) end Part:Destroy() end)