Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local runDummyScript = function(f,scri)
- local oldenv = getfenv(f)
- local newenv = setmetatable({}, {
- __index = function(_, k)
- if k:lower() == 'script' then
- return scri
- else
- return oldenv[k]
- end
- end
- })
- setfenv(f, newenv)
- ypcall(function() f() end)
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- mas.Name = "CompiledModel"
- o1 = Instance.new("Model")
- o2 = Instance.new("Part")
- o3 = Instance.new("Part")
- o4 = Instance.new("Part")
- o5 = Instance.new("IntValue")
- o6 = Instance.new("Script")
- o7 = Instance.new("IntValue")
- o8 = Instance.new("Script")
- o9 = Instance.new("Part")
- o10 = Instance.new("Part")
- o1.Parent = mas
- o2.Parent = o1
- o2.BrickColor = BrickColor.new("Really black")
- o2.Position = Vector3.new(-6.80000305, 0.49999994, 76.2000122)
- o2.Anchored = true
- o2.Shape = Enum.PartType.Ball
- o2.Size = Vector3.new(1.39999998, 1.39999998, 1.39999998)
- o2.CFrame = CFrame.new(-6.80000305, 0.49999994, 76.2000122, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- o2.BottomSurface = Enum.SurfaceType.Smooth
- o2.TopSurface = Enum.SurfaceType.Smooth
- o2.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- o2.Position = Vector3.new(-6.80000305, 0.49999994, 76.2000122)
- o3.Parent = o1
- o3.BrickColor = BrickColor.new("Really black")
- o3.Position = Vector3.new(-6.80000305, 0.599999964, 74.0999985)
- o3.Anchored = true
- o3.Shape = Enum.PartType.Ball
- o3.Size = Vector3.new(1.39999998, 1.39999998, 1.39999998)
- o3.CFrame = CFrame.new(-6.80000305, 0.599999964, 74.0999985, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- o3.BottomSurface = Enum.SurfaceType.Smooth
- o3.TopSurface = Enum.SurfaceType.Smooth
- o3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- o3.Position = Vector3.new(-6.80000305, 0.599999964, 74.0999985)
- o4.Name = "MovingPart"
- o4.Parent = o1
- o4.Position = Vector3.new(-8.00000286, 0.800000072, 75.2000046)
- o4.Anchored = true
- o4.Size = Vector3.new(3.6000011, 0.799999893, 1.20000005)
- o4.CFrame = CFrame.new(-8.00000286, 0.800000072, 75.2000046, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- o4.BottomSurface = Enum.SurfaceType.Smooth
- o4.TopSurface = Enum.SurfaceType.Smooth
- o4.Position = Vector3.new(-8.00000286, 0.800000072, 75.2000046)
- o5.Name = "Rate"
- o5.Parent = o4
- o6.Name = "MoveScript"
- o6.Parent = o4
- table.insert(cors,coroutine.create(function()
- wait()
- runDummyScript(function()
- --[[
- Rate = How far left / right it goes; if it's 0, then it will decide randomly between two numbers (Edit in script).
- Speed = How many studs it moves per second; if the value is 1, it will move one stud every second; two if value is 2; etc.
- --]]
- local object = script.Parent
- local speed = object.Speed.Value
- local rate = object.Rate.Value
- local direction = Vector3.new(1, 0, 0)
- part = {
- move = function() -- Makes it a method :D
- local s = 0.03
- for d = 0,1,s do
- object.CFrame = object.CFrame + Vector3.new(s * direction.X, 0, 0)
- if d % (speed / 10) == 0 then
- wait()
- end
- end
- end
- }
- while true do
- nRate = rate
- if nRate == 0 then
- nRate = math.random(2, 10)
- end
- direction = direction * -1
- for i = 1,nRate do
- part:move()
- end
- wait()
- end
- --direction = Vector3.new(0,0,1)
- -- part:move()
- end,o6)
- end))
- o7.Name = "Speed"
- o7.Parent = o4
- o7.Value = 20
- o8.Name = "WeldScript"
- o8.Parent = o1
- table.insert(cors,coroutine.create(function()
- wait()
- runDummyScript(function()
- function Weld(x, y)
- local weld = Instance.new("Weld")
- weld.Part0 = x
- weld.Part1 = y
- weld.C0 = x.CFrame:inverse() * CFrame.new(x.Position)
- weld.C1 = y.CFrame:inverse() * CFrame.new(x.Position)
- weld.Parent = x
- end
- local prev
- local unanchor = {}
- function search ( n )
- n = n or script.Parent
- for i, v in pairs(n:getChildren()) do
- if v:IsA("BasePart") then
- if prev then
- Weld(v, prev)
- prev = v
- unanchor[#unanchor + 0] = v
- else
- prev = v
- unanchor[#unanchor + 0] = v
- end
- end
- search(v)
- end
- end
- function unanchormodel(m)
- local g = m:GetChildren()
- for i = 1, #g do
- if (g[i]:IsA("BasePart")) then
- g[i].Anchored = false
- elseif (g[i]:IsA("Model")) then
- unanchormodel(g[i])
- end
- end
- end
- search()
- wait()
- unanchormodel(script.Parent)
- end,o8)
- end))
- o9.Parent = o1
- o9.BrickColor = BrickColor.new("Really black")
- o9.Position = Vector3.new(-9.60000229, 0.699997783, 76.2000122)
- o9.Anchored = true
- o9.Shape = Enum.PartType.Ball
- o9.Size = Vector3.new(1.39999998, 1.39999998, 1.39999998)
- o9.CFrame = CFrame.new(-9.60000229, 0.699997783, 76.2000122, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- o9.BottomSurface = Enum.SurfaceType.Smooth
- o9.TopSurface = Enum.SurfaceType.Smooth
- o9.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- o9.Position = Vector3.new(-9.60000229, 0.699997783, 76.2000122)
- o10.Parent = o1
- o10.BrickColor = BrickColor.new("Really black")
- o10.Position = Vector3.new(-9.60000229, 0.799999833, 74.0999985)
- o10.Anchored = true
- o10.Shape = Enum.PartType.Ball
- o10.Size = Vector3.new(1.39999998, 1.39999998, 1.39999998)
- o10.CFrame = CFrame.new(-9.60000229, 0.799999833, 74.0999985, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- o10.BottomSurface = Enum.SurfaceType.Smooth
- o10.TopSurface = Enum.SurfaceType.Smooth
- o10.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- o10.Position = Vector3.new(-9.60000229, 0.799999833, 74.0999985)
- mas.Parent = workspace
- mas:MakeJoints()
- local mas1 = mas:GetChildren()
- for i=1,#mas1 do
- mas1[i].Parent = script
- ypcall(function() mas1[i]:MakeJoints() end)
- end
- mas:Destroy()
- for i=1,#cors do
- coroutine.resume(cors[i])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement