Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. --[[
  2. Title: LocalRopeRenderScript
  3. Created: 07/08/2016 @ 03:00
  4. Last Edited: 11/09/2016 @ 02:45
  5. Author: FlyScript
  6. --]]
  7.  
  8. if game.Workspace.CurrentCamera:FindFirstChild("FlyRopes") then
  9. game.Workspace.CurrentCamera.FlyRopes:Destroy()
  10. end
  11.  
  12. local rm = Instance.new("Model", game.Workspace.CurrentCamera)
  13. rm.Name = "FlyRopes"
  14.  
  15. local ropes = {}
  16.  
  17. for _, v in pairs(game.Workspace:GetChildren()) do
  18. for _, r in pairs(v:GetChildren()) do
  19. if r:IsA("RopeConstraint") and r.Attachment0 and r.Attachment1 and r:FindFirstChild("RopeConf") and r.RopeConf:FindFirstChild("Colour") and type(r.RopeConf.Colour.Value) == "userdata" and r.RopeConf:FindFirstChild("Material") and tostring(r.RopeConf.Material.Value) and pcall(function() v = Enum.Material[r.RopeConf.Material.Value] end) == true and r.RopeConf:FindFirstChild("Thickness") and tonumber(r.RopeConf.Thickness.Value) then
  20. local s = Instance.new("Part")
  21. s.Name,s.Anchored,s.CanCollide,s.Size,s.TopSurface,s.BottomSurface,s.BrickColor,s.Material,s.Parent="Rope ["..r.Attachment0.Parent.Name.."]/["..r.Attachment1.Parent.Name.."]",true,false,Vector3.new(1,1,1),Enum.SurfaceType.Smooth,Enum.SurfaceType.Smooth,r.RopeConf.Colour.Value,Enum.Material[tostring(r.RopeConf.Material.Value)],rm
  22. local m = Instance.new("CylinderMesh", s)
  23. m.Scale = Vector3.new(tonumber(r.RopeConf.Thickness.Value),1,tonumber(r.RopeConf.Thickness.Value))
  24. ropes[#ropes+1]={s, r.Attachment0, r.Attachment1}
  25. end
  26. end
  27. end
  28.  
  29. game:GetService("RunService"):BindToRenderStep("Ropes", Enum.RenderPriority.First.Value, (function()
  30. for _, v in pairs(ropes) do
  31. v[1].CFrame = (CFrame.new(v[2].Parent.Position, v[3].Parent.Position)*CFrame.Angles(math.rad(90),0,0))+(CFrame.new(v[2].Parent.Position, v[3].Parent.Position).lookVector*((v[2].Parent.Position-v[3].Parent.Position).Magnitude)/2)
  32. v[1].Mesh.Scale = Vector3.new(v[1].Mesh.Scale.X, ((v[2].Parent.Position-v[3].Parent.Position).Magnitude), v[1].Mesh.Scale.Z)
  33. end
  34. end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement