Advertisement
vL4d_4eVer

dungeon

Jan 28th, 2019 (edited)
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.24 KB | None | 0 0
  1. script.Parent=workspace
  2. local tweens = game:GetService("TweenService")
  3. local debrs = game:GetService("Debris")
  4.  
  5. local ins = Instance.new
  6. local v3 = Vector3.new
  7. local cf = CFrame.new
  8. local angles = CFrame.Angles
  9. local rad = math.rad
  10. local huge = math.huge
  11. local cos = math.cos
  12. local sin = math.sin
  13. local tan = math.tan
  14. local ray = Ray.new
  15. local random = math.random
  16. local ud = UDim.new
  17. local ud2 = UDim2.new
  18. local c3 = Color3.new
  19. local rgb = Color3.fromRGB
  20. local bc = BrickColor.new
  21.  
  22. local platformWidth = 50
  23. local platfromHeight = 5
  24. local cfpos = cf(0,200,1500)*cf(0,platfromHeight/2,0)
  25. local bcf = cf(30,0,-30)
  26. local material = "Cobblestone"
  27. local colors = {"Dark green","Black","Tr. Green","Earth green","Parsley green","Shamrock"}
  28. local start = true
  29. local endd = false
  30. local curcolor
  31. local startp
  32. local hitboxparts = {}
  33.  
  34. local directions = {In = Enum.EasingDirection.In,
  35.     Out = Enum.EasingDirection.Out,
  36.     InOut = Enum.EasingDirection.InOut
  37. }
  38. local styles = {Linear = Enum.EasingStyle.Linear,
  39.     Back = Enum.EasingStyle.Back,
  40.     Bounce = Enum.EasingStyle.Bounce,
  41.     Sine = Enum.EasingStyle.Sine,
  42.     Quad = Enum.EasingStyle.Quad,
  43.     Elastic = Enum.EasingStyle.Elastic,
  44.     Quart = Enum.EasingStyle.Quart,
  45.     Quint = Enum.EasingStyle.Quint
  46. }
  47.  
  48. local mod = ins("Model",script)
  49.  
  50. local tlerp = function(part,tablee,leinght,easingstyle,easingdirec)
  51.     local info = TweenInfo.new(
  52.     leinght,
  53.     easingstyle,
  54.     easingdirec,
  55.     0,
  56.     false,
  57.     0
  58.     )
  59.     local lerp = tweens:Create(part,info,tablee)
  60.     lerp:Play()
  61. end
  62. function sound(parent,id,vol,pitch)
  63. pcall(function()
  64. local sound = Instance.new("Sound",parent)
  65. sound.Volume = vol
  66. sound.SoundId = "rbxassetid://"..id
  67. sound.Pitch = pitch
  68. sound:Play()
  69. coroutine.resume(coroutine.create(function()
  70. repeat
  71. wait()
  72. until sound.Playing == false
  73. sound:Destroy()
  74. end))
  75. end)
  76. end
  77. function lesserfirepart(parttofire)
  78.     coroutine.resume(coroutine.create(function()
  79.         for i = 1,random(6,12) do
  80.             if not parttofire or not parttofire.Parent then
  81.                 break
  82.             end
  83.                 damagingfire(parttofire,effects,"Maroon","Deep orange",math.random(5,9)/5,math.random(2,5)/5,math.random(6,10)/12,"Neon",2,6,"Block",3,0,0,true,random(1,2))
  84.             wait(.25)
  85.             end
  86.     end))
  87. end
  88. function damagingfire(partp,parent,color1,color2,ssize,osize,leinght,material,minr,maxr,shape,spread,st,ot,onlyraise,damage)
  89.     local deb = false
  90.     local part = Instance.new("Part",parent) part.Size = Vector3.new(ssize,ssize,ssize) part.Transparency = st part.CanCollide = false part.Anchored = true part.Name="Fire" part.Shape = shape part.Material = material part.BrickColor = BrickColor.new(color1) part.CFrame = partp.CFrame * CFrame.new(partp.Size.x/math.random(-20,20),partp.Size.y/math.random(-20,20),partp.Size.z/math.random(-20,20))
  91.     if onlyraise == true then
  92.         part.CFrame = CFrame.new(part.CFrame.p,Vector3.new(part.Position.y,part.CFrame.y,part.CFrame.z))
  93.     end
  94.     part.Touched:Connect(function(hit)
  95.         if not deb then
  96.             local newhum = hit.Parent:FindFirstChildOfClass("Humanoid")
  97.             if newhum and newhum ~= hum then
  98.                 deb = false
  99.                 local rand = random(1,6)
  100.                 if rand == 3 then
  101.                     lesserfirepart(hit)
  102.                 end
  103.                 newhum.Health = newhum.Health -damage
  104.             end
  105.         end
  106.     end)
  107.     local pcf = part.CFrame
  108.     tlerp(part,{CFrame = pcf * CFrame.new(math.random(-spread,spread)/math.random(2,4),math.random(minr,maxr),math.random(-spread,spread)/math.random(2,4)) * CFrame.Angles(rad(math.random(-180,180)),rad(math.random(-180,180)),rad(math.random(-180,180))),Size = Vector3.new(osize,osize,osize),Color = BrickColor.new(color2).Color,Transparency = ot},leinght,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  109.     game:GetService("Debris"):AddItem(part,leinght)
  110. end
  111. function msg(text,time)
  112. local msg = ins("Hint",workspace)
  113. msg.Text = text
  114. game:GetService("Debris"):AddItem(msg,time)
  115. end
  116. function maketorch(pos,face)
  117.     local p = ins("Part",mod)
  118.     p.Material = "Wood"
  119.     p.BrickColor = bc("Brown")
  120.     p.Anchored = true
  121.     p.Size = v3(.02,.06,.02)*platformWidth
  122.     p.CFrame = pos
  123.     local oldp = p
  124.     local p = ins("Part",mod)
  125.     p.Material = "Neon"
  126.     p.BrickColor = bc("CGA brown")
  127.     p.Anchored = true
  128.     p.Size = v3(.0225,.0225,.0225)*platformWidth
  129.     p.CFrame = oldp.CFrame*cf(0,oldp.Size.y/2+p.Size.y/2,0)
  130.     local light = ins("SurfaceLight",p)
  131.     light.Face = face
  132.     light.Color = p.Color
  133.     light.Angle = 180
  134.     light.Range = 35
  135.     light.Brightness = 2.5
  136. end
  137. function tooltorch(who)
  138.     local tool = ins("Tool")
  139.     tool.Name = "Torch"
  140.     local p = ins("Part",tool)
  141.     p.Material = "Wood"
  142.     p.BrickColor = bc("Brown")
  143.     p.Anchored = false
  144.     p.CanCollide = false
  145.     p.Size = v3(.35,1.5,.35)
  146.     p.Name = "Handle"
  147.     p.CFrame = cf(0,1000,0)
  148.     local oldp = p
  149.     local p = ins("Part",oldp)
  150.     p.Material = "Neon"
  151.     p.BrickColor = bc("CGA brown")
  152.     p.Anchored = false
  153.     p.CanCollide = false
  154.     p.Size = v3(.425,.425,.425)
  155.     p.CFrame = oldp.CFrame*cf(0,oldp.Size.y/2+p.Size.y/2,0)
  156.     local weld = ins("WeldConstraint",oldp)
  157.     weld.Part0 = oldp
  158.     weld.Part1 = p
  159.     local light = ins("SurfaceLight",p)
  160.     light.Face = "Front"
  161.     light.Color = p.Color
  162.     light.Angle = 180
  163.     light.Range = 20
  164.     light.Brightness = 4
  165.     local light = ins("SurfaceLight",p)
  166.     light.Face = "Back"
  167.     light.Color = p.Color
  168.     light.Angle = 180
  169.     light.Range = 20
  170.     light.Brightness = 4
  171.     tool.Parent = who
  172. end
  173. function maketrap(pos)
  174.     local p = ins("Part",mod)
  175.     p.Material = "Slate"
  176.     p.BrickColor = bc("Darkgrey")
  177.     p.Anchored = true
  178.     p.Size = v3(.15,.25,.15)*platformWidth
  179.     p.CFrame = pos
  180.     p.CanCollide = false
  181.     local msh = ins("BlockMesh",p)
  182.     msh.Scale = v3(.25,.01,.25)
  183.     local deb = false
  184.     p.Touched:Connect(function(hit)
  185.         local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  186.         if hum and not deb then
  187.             deb = true
  188.             sound(p,158853971,10,15)
  189.             for i = 1,random(5,8) do
  190.                 damagingfire(p,mod,"Maroon","Deep orange",(math.random(6,10)/50)*platformWidth/2.5,.01,math.random(6,10)/10,"Neon",2*platformWidth/10,4*platformWidth/10,"Block",3,0,0,false,random(3,6))
  191.                 wait()
  192.             end
  193.             wait(3.5)
  194.             deb = false
  195.         end
  196.     end)
  197. end
  198. function rayc(spos,direc,ignore,dist)
  199.     local rai = ray(spos,direc.Unit * dist)
  200.     local rhit,rpos,rrot = workspace:FindPartOnRayWithIgnoreList(rai,ignore,false,false)
  201.     return rhit,rpos,rrot
  202. end
  203. function createPlatform(cfr)
  204.     local plat = ins("Part",mod)
  205.     plat.Anchored = true
  206.     plat.Size = v3(platformWidth,platfromHeight,platformWidth)
  207.     plat.CFrame = cfr
  208.     plat.Material = material
  209.     curcolor = bc(colors[random(1,#colors)])
  210.     local rannum = random(1,2)
  211.     if rannum == 2 and not start then
  212.         local xa = random(-10,10)
  213.         local za = random(-10,10)
  214.         if xa == 1 then
  215.             xa = 2
  216.         elseif xa == -1 then
  217.             xa = -2
  218.         end
  219.         if za == 1 then
  220.             za = 2
  221.         elseif za == -1 then
  222.             za = -2
  223.         end
  224.         maketrap(plat.CFrame*cf(xa,plat.Size.y/2,za),tostring(plat.BrickColor))
  225.     end
  226.     if start then
  227.         plat.BrickColor = bc("Camo")
  228.         local light = ins("SurfaceLight",plat)
  229.         light.Face = "Top"
  230.         light.Color = plat.Color
  231.         light.Angle = 180
  232.         light.Range = plat.Size.z
  233.         light.Brightness = 2
  234.         local backb = ins("Part",plat)
  235.         backb.Anchored = true
  236.         backb.CanCollide = false
  237.         backb.Material = "Neon"
  238.         backb.BrickColor = bc("CGA brown")
  239.         backb.Size = v3(.1,.15,.1)*platformWidth
  240.         backb.CFrame = plat.CFrame * cf(plat.Size.x/3,plat.Size.y/2+backb.Size.y/2,plat.Size.z/3)
  241.         backb.Transparency = .5
  242.         local p = ins("Part",plat)
  243.         p.Material = "Neon"
  244.         p.BrickColor = bc("CGA brown")
  245.         p.Anchored = true
  246.         p.Size = v3(.025,.025,.025)*platformWidth
  247.         p.CFrame = plat.CFrame * cf(-plat.Size.x/7.5,(plat.Size.y/2)+p.Size.y/2,-plat.Size.z/7.5)
  248.         p.CanCollide = false
  249.         p.Transparency = .5
  250.         local billb = ins("BillboardGui",mod)
  251.         billb.Adornee = p
  252.         billb.StudsOffset = Vector3.new(0,backb.Size.y/1.5,0)
  253.         billb.Size = UDim2.new(4.5,0,1.5,0)
  254.         billb.AlwaysOnTop = true
  255.         billb.MaxDistance = 20
  256.         local l = Instance.new("TextBox",billb)
  257.         l.Size = UDim2.new(1,0,1,0)
  258.         l.BorderSizePixel = 0
  259.         l.BackgroundTransparency = 1
  260.         l.TextScaled = true
  261.         l.Text = "Click to get the torch"
  262.         l.TextColor = bc("CGA brown")
  263.         l.Rotation = 0
  264.         l.TextStrokeTransparency = 0
  265.         l.TextStrokeColor3 = bc("CGA brown").Color
  266.         local cld = ins("ClickDetector",p)
  267.         cld.MouseClick:Connect(function(plr)
  268.         tooltorch(plr.Backpack)
  269.         end)
  270.         local billb = ins("BillboardGui",mod)
  271.         billb.Adornee = backb
  272.         billb.StudsOffset = Vector3.new(0,backb.Size.y/1.5,0)
  273.         billb.Size = UDim2.new(4.5,0,1.5,0)
  274.         billb.AlwaysOnTop = true
  275.         billb.MaxDistance = 20
  276.         local l = Instance.new("TextBox",billb)
  277.         l.Size = UDim2.new(1,0,1,0)
  278.         l.BorderSizePixel = 0
  279.         l.BackgroundTransparency = 1
  280.         l.TextScaled = true
  281.         l.Text = "Touch this part to get back to the baseplate"
  282.         l.TextColor = bc("CGA brown")
  283.         l.Rotation = 0
  284.         l.TextStrokeTransparency = 0
  285.         l.TextStrokeColor3 = bc("CGA brown").Color
  286.         backb.Touched:Connect(function(hit)
  287.             local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  288.             if hum then
  289.                 local rut = hum.Parent:FindFirstChild("HumanoidRootPart")
  290.                 if rut then
  291.                     rut.CFrame = cf(0,3,0)
  292.                 end
  293.             end
  294.         end)
  295.     elseif endd then
  296.         plat.BrickColor = curcolor
  297.     elseif not start and not endd then
  298.         plat.BrickColor = curcolor
  299.     end
  300.     local cfs = {
  301.         plat.CFrame *cf(plat.Size.x+0/5,0,0),
  302.         plat.CFrame *cf(-plat.Size.x-0/5,0,0),
  303.         plat.CFrame *cf(0,0,plat.Size.z+0/5),
  304.         plat.CFrame *cf(0,0,-plat.Size.z-0/5)
  305.         }
  306.     if endd then
  307.         local rew = ins("Part",plat)
  308.         rew.Anchored = true
  309.         rew.Material = "Glass"
  310.         rew.BrickColor = bc("Gold")
  311.         rew.Size = v3(.05,.05,.05)*platformWidth
  312.         rew.CFrame = plat.CFrame * cf(0,(rew.Size.y/2)+plat.Size.y/2,0)
  313.         rew.Name = random(-999999,999999)
  314.         print(rew.Name)
  315.         local light = ins("SurfaceLight",rew)
  316.         light.Face = "Top"
  317.         light.Color = rew.Color
  318.         light.Angle = 180
  319.         light.Range = 30
  320.         light.Brightness = 3
  321.         local deb = false
  322.         rew.Touched:Connect(function(hit)
  323.             local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  324.             if hum then
  325.                 local rut = hum.Parent:FindFirstChild("HumanoidRootPart")
  326.                 if rut and not deb then
  327.                     deb = true
  328.                     hum.Health = hum.MaxHealth
  329.                     sound(workspace,160737154,2,1)
  330.                     msg(hum.Parent.Name.." found the gold block!",3)
  331.                     gen()
  332.                     rut.CFrame = startp.CFrame * cf(0,3,0)
  333.                 end
  334.             end
  335.         end)
  336.     end
  337.     local safepart = ins("Part",plat)
  338.     safepart.Anchored = true
  339.     safepart.Material = plat.Material
  340.     safepart.Color = plat.Color
  341.     safepart.Size = v3(20*platformWidth,5,20*platformWidth)
  342.     safepart.CFrame = cfpos * cf(0,-plat.Size.y/2-(safepart.Size.y/2),0)
  343.     safepart.CanCollide = false
  344.     safepart.Transparency = 1
  345.     safepart.Touched:Connect(function(hit)
  346.         local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  347.         if hum then
  348.             local rut = hum.Parent:FindFirstChild("HumanoidRootPart")
  349.             if rut then
  350.                 rut.CFrame = startp.CFrame * cf(0,3,0)
  351.             end
  352.         end
  353.     end)
  354.     local ruf = ins("Part",plat)
  355.     ruf.Anchored = true
  356.     ruf.Material = plat.Material
  357.     ruf.Color = plat.Color
  358.     ruf.Size = plat.Size
  359.     ruf.CFrame = plat.CFrame * cf(0,(.75*platformWidth)+plat.Size.y,0)
  360.     local dp = ins("Part",plat)
  361.     dp.Anchored = true
  362.     dp.CanCollide = false
  363.     dp.Transparency = 1
  364.     dp.Material = plat.Material
  365.     dp.Color = plat.Color
  366.     dp.Size = v3(1,.75,1)*platformWidth
  367.     dp.CFrame = plat.CFrame * cf(0,(dp.Size.y/2)+(plat.Size.y/2),0)
  368.     dp.Name = random(-999999,999999)
  369.     dp.Touched:Connect(function(hit)
  370.         local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  371.         if hum then
  372.             if hum.WalkSpeed >16 then
  373.                 hum.Parent:BreakJoints()
  374.             end
  375.         end
  376.     end)
  377.     table.insert(hitboxparts,dp)
  378.     local pil = ins("Part",plat)
  379.     pil.Anchored = true
  380.     pil.Material = plat.Material
  381.     pil.Color = plat.Color
  382.     pil.Size = v3(.15,.75,.15)*platformWidth
  383.     pil.CFrame = plat.CFrame * cf(plat.Size.x/2-pil.Size.x/2,pil.Size.y/2+plat.Size.y/2,plat.Size.z/2-pil.Size.z/2)
  384.     local pw = ins("Part",plat)
  385.     pw.Anchored = true
  386.     pw.Material = plat.Material
  387.     pw.Color = plat.Color
  388.     pw.Size = v3(.15,.75,.2)*platformWidth
  389.     pw.CFrame = pil.CFrame * cf(0,0,-pw.Size.z/2-pil.Size.z/2)
  390.     local pw = ins("Part",plat)
  391.     pw.Anchored = true
  392.     pw.Material = plat.Material
  393.     pw.Color = plat.Color
  394.     pw.Size = v3(.2,.75,.15)*platformWidth
  395.     pw.CFrame = pil.CFrame * cf(-pw.Size.x/2-pil.Size.x/2,0,0)
  396.     local pil = ins("Part",plat)
  397.     pil.Anchored = true
  398.     pil.Material = plat.Material
  399.     pil.Color = plat.Color
  400.     pil.Size = v3(.15,.75,.15)*platformWidth
  401.     pil.CFrame = plat.CFrame * cf(-plat.Size.x/2+pil.Size.x/2,pil.Size.y/2+plat.Size.y/2,-plat.Size.z/2+pil.Size.z/2)
  402.     local pw = ins("Part",plat)
  403.     pw.Anchored = true
  404.     pw.Material = plat.Material
  405.     pw.Color = plat.Color
  406.     pw.Size = v3(.15,.75,.2)*platformWidth
  407.     pw.CFrame = pil.CFrame * cf(0,0,pw.Size.z/2+pil.Size.z/2)
  408.     local pw = ins("Part",plat)
  409.     pw.Anchored = true
  410.     pw.Material = plat.Material
  411.     pw.Color = plat.Color
  412.     pw.Size = v3(.2,.75,.15)*platformWidth
  413.     pw.CFrame = pil.CFrame * cf(pw.Size.x/2+pil.Size.x/2,0,0)
  414.     local pil = ins("Part",plat)
  415.     pil.Anchored = true
  416.     pil.Material = plat.Material
  417.     pil.Color = plat.Color
  418.     pil.Size = v3(.15,.75,.15)*platformWidth
  419.     pil.CFrame = plat.CFrame * cf(-plat.Size.x/2+pil.Size.x/2,pil.Size.y/2+plat.Size.y/2,plat.Size.z/2-pil.Size.z/2)
  420.     local pw = ins("Part",plat)
  421.     pw.Anchored = true
  422.     pw.Material = plat.Material
  423.     pw.Color = plat.Color
  424.     pw.Size = v3(.15,.75,.2)*platformWidth
  425.     pw.CFrame = pil.CFrame * cf(0,0,-pw.Size.z/2-pil.Size.z/2)
  426.     local pw = ins("Part",plat)
  427.     pw.Anchored = true
  428.     pw.Material = plat.Material
  429.     pw.Color = plat.Color
  430.     pw.Size = v3(.2,.75,.15)*platformWidth
  431.     pw.CFrame = pil.CFrame * cf(pw.Size.x/2+pil.Size.x/2,0,0)
  432.     local pil = ins("Part",plat)
  433.     pil.Anchored = true
  434.     pil.Material = plat.Material
  435.     pil.Color = plat.Color
  436.     pil.Size = v3(.15,.75,.15)*platformWidth
  437.     pil.CFrame = plat.CFrame * cf(plat.Size.x/2-pil.Size.x/2,pil.Size.y/2+plat.Size.y/2,-plat.Size.z/2+pil.Size.z/2)
  438.     local pw = ins("Part",plat)
  439.     pw.Anchored = true
  440.     pw.Material = plat.Material
  441.     pw.Color = plat.Color
  442.     pw.Size = v3(.15,.75,.2)*platformWidth
  443.     pw.CFrame = pil.CFrame * cf(0,0,pw.Size.z/2+pil.Size.z/2)
  444.     local pw = ins("Part",plat)
  445.     pw.Anchored = true
  446.     pw.Material = plat.Material
  447.     pw.Color = plat.Color
  448.     pw.Size = v3(.2,.75,.15)*platformWidth
  449.     pw.CFrame = pil.CFrame * cf(-pw.Size.x/2-pil.Size.x/2,0,0)
  450.     start = false
  451.     endd = false
  452.     return cfs,plat
  453. end
  454. function gen()
  455. hitboxparts = {}
  456. start = true
  457. mod:ClearAllChildren()
  458. local cfs,plat = createPlatform(cfpos)
  459. local b = ins("Part",mod)
  460. b.Anchored = true
  461. b.CanCollide = false
  462. b.Material = "Neon"
  463. b.BrickColor = bc("CGA brown")
  464. b.Size = v3(3,.5,3)
  465. b.CFrame = bcf
  466. b.Transparency = .35
  467. b.Touched:Connect(function(hit)
  468.         local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
  469.         if hum then
  470.             local rut = hum.Parent:FindFirstChild("HumanoidRootPart")
  471.             if rut then
  472.                 rut.CFrame = startp.CFrame * cf(0,3,0)
  473.             end
  474.         end
  475.     end)
  476. startp = plat
  477. local curcf = cfpos
  478. local oldcf = curcf
  479. local endnum
  480. local plats = {}
  481. table.insert(plats,plat)
  482. local num = random(30,45)
  483. for i = 1,num do
  484.     endnum = i
  485.     if i == num then
  486.         endd = true
  487.     end
  488.     curcf = cfs[random(1,#cfs)]
  489.     for i,v in pairs(plats) do
  490.         if (v3(curcf.x,curcf.y,curcf.z)-v.Position).Magnitude <platformWidth then
  491.             repeat
  492.             curcf = cfs[random(1,#cfs)]
  493.             until (v3(curcf.x,curcf.y,curcf.z)-v.Position).Magnitude > (platformWidth)-platformWidth/10
  494.         end
  495.     end
  496.     cfs,plat = createPlatform(curcf)
  497.     table.insert(plats,plat)
  498.     oldcf = curcf
  499. end
  500. for i,v in pairs(hitboxparts) do
  501.     local plat = v.Parent
  502.     local dp = v
  503.     local dirs = {dp.CFrame.LookVector,-dp.CFrame.LookVector,dp.CFrame.RightVector,-dp.CFrame.RightVector}
  504.     local curdir = dirs[1]
  505.     for i = 1,4 do
  506.         local hit,pos,rot = rayc(dp.Position,dirs[i],{dp},platformWidth/1.75)
  507.         curdir = dirs[i]
  508.         if not hit then
  509.             if curdir == dirs[1] then
  510.                 local pw = ins("Part",plat)
  511.                 pw.Anchored = true
  512.                 pw.Material = plat.Material
  513.                 pw.Color = plat.Color
  514.                 pw.Size = v3(.3,.75,.15)*platformWidth
  515.                 pw.CFrame = plat.CFrame * cf(0,(plat.Size.y/2)+(pw.Size.y/2),-(plat.Size.z/2)+(pw.Size.z/2))
  516.                 local randn = random(1,3)
  517.                 if randn == 1 then
  518.                     maketorch(pw.CFrame*cf(0,0,(pw.Size.z/2)+(.02*platformWidth)/2)*angles(rad(35),rad(180),0),"Front")
  519.                 end
  520.             elseif curdir == dirs[2] then
  521.                 local pw = ins("Part",plat)
  522.                 pw.Anchored = true
  523.                 pw.Material = plat.Material
  524.                 pw.Color = plat.Color
  525.                 pw.Size = v3(.3,.75,.15)*platformWidth
  526.                 pw.CFrame = plat.CFrame * cf(0,(plat.Size.y/2)+(pw.Size.y/2),(plat.Size.z/2)-(pw.Size.z/2))
  527.                 local randn = random(1,3)
  528.                 if randn == 1 then
  529.                     maketorch(pw.CFrame*cf(0,0,-(pw.Size.z/2)-(.02*platformWidth)/2)*angles(rad(-35),0,0),"Front")
  530.                 end
  531.             elseif curdir == dirs[3] then
  532.                 local pw = ins("Part",plat)
  533.                 pw.Anchored = true
  534.                 pw.Material = plat.Material
  535.                 pw.Color = plat.Color
  536.                 pw.Size = v3(.15,.75,.3)*platformWidth
  537.                 pw.CFrame = plat.CFrame * cf((plat.Size.x/2)-(pw.Size.x/2),(plat.Size.y/2)+(pw.Size.y/2),0)
  538.                 local randn = random(1,3)
  539.                 if randn == 1 then
  540.                     maketorch(pw.CFrame*cf(-(pw.Size.x/2)-(.02*platformWidth)/2,0,0)*angles(0,0,rad(35)),"Left")
  541.                 end
  542.             elseif curdir == dirs[4] then
  543.                 local pw = ins("Part",plat)
  544.                 pw.Anchored = true
  545.                 pw.Material = plat.Material
  546.                 pw.Color = plat.Color
  547.                 pw.Size = v3(.15,.75,.3)*platformWidth
  548.                 pw.CFrame = plat.CFrame * cf(-(plat.Size.x/2)+(pw.Size.x/2),(plat.Size.y/2)+(pw.Size.y/2),0)
  549.                 local randn = random(1,3)
  550.                 if randn == 1 then
  551.                     maketorch(pw.CFrame*cf((pw.Size.x/2)+(.02*platformWidth)/2,0,0)*angles(0,0,rad(-35)),"Right")
  552.                 end
  553.             end
  554.         end
  555.     end
  556.     for i,v in pairs(mod:GetDescendants()) do
  557.         if v:IsA("Part") then
  558.             v.Locked = true
  559.         end
  560.     end
  561. end
  562. print("total amount: "..endnum)
  563. end
  564. gen()
  565. local rem = ins("RemoteEvent",owner.PlayerGui)
  566. rem.Name = "ddd"
  567. rem.OnServerEvent:Connect(function(plr)
  568. maketorch(owner.Character.Torso.CFrame)
  569. gen()
  570. end)
  571. owner.Chatted:Connect(function(msg)
  572. if msg:lower() == "tp" then
  573. owner.Character.HumanoidRootPart.CFrame = startp.CFrame * cf(0,3,0)
  574. end
  575. end)
  576. local client = NLS([[
  577. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  578. local rem = owner.PlayerGui:WaitForChild("ddd")
  579. mouse.KeyDown:Connect(function(key)
  580. if key == "r" then
  581. rem:FireServer()
  582. end
  583. end)
  584. ]],owner.PlayerGui)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement