KrYn0MoRe

really cool stairs

Nov 29th, 2020 (edited)
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. local f = nil
  2. local y,z = 1,1
  3. local extra = 50
  4. local max = 300
  5.  
  6. local stairs = {}
  7.  
  8. function set_prop(i,p)
  9.     if i and p then else return end
  10.     local n = i/25
  11.     local center = CFrame.new(0,0.5,20)
  12.     local r1 = math.abs(math.sin(n))
  13.     local r2 = math.abs(math.cos(n))
  14.     p.Color = Color3.new(r1,r1,r2)
  15.     p.Size = Vector3.new(20, y, z)
  16.     p.Transparency = 0
  17.     p.Anchored = true
  18.     p.CanCollide = true
  19.     p.Locked = true
  20.     local checkpoints = math.floor(i/50)
  21.     local cf2 = CFrame.new()
  22.     local size2 = Vector3.new(0,0,0)
  23.     if checkpoints == i/50 then
  24.         size2 = size2+Vector3.new(extra, 0, extra)
  25.     end
  26.     for i = 1,checkpoints do
  27.         cf2 = cf2*CFrame.new(0,0,extra/2)
  28.     end
  29.     p.Size = Vector3.new(20, y, z)+size2
  30.     p.CFrame = center*CFrame.new(0,(i*y)-y,i*z)*cf2
  31.     stairs[p] = i
  32.     p.Parent = f
  33. end
  34.  
  35. function make_stair(i)
  36.     local p = Instance.new("Part")
  37.     set_prop(i,p)
  38.     p.Changed:Connect(function()
  39.         coroutine.wrap(function()
  40.             p:Destroy()
  41.         end)()
  42.     end)
  43. end
  44.  
  45. function make_folder()
  46.     f = Instance.new("Folder",workspace)
  47.     f.ChildRemoved:Connect(function(v)
  48.         local i = stairs[v]
  49.         game:GetService("RunService").Heartbeat:Wait()
  50.         coroutine.wrap(function()
  51.             v:Destroy()
  52.         end)()
  53.         coroutine.wrap(function()
  54.             make_stair(i)
  55.         end)()
  56.     end)
  57. end
  58.  
  59. workspace.ChildRemoved:Connect(function(v)
  60.     if v == f then
  61.         make_folder()
  62.     end
  63. end)
  64.  
  65. make_folder()
  66.  
  67. for i = 1,max do
  68.     make_stair(i)
  69. end
Add Comment
Please, Sign In to add comment