Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Title: LocalRopeRenderScript
- Created: 07/08/2016 @ 03:00
- Last Edited: 11/09/2016 @ 02:45
- Author: FlyScript
- --]]
- if game.Workspace.CurrentCamera:FindFirstChild("FlyRopes") then
- game.Workspace.CurrentCamera.FlyRopes:Destroy()
- end
- local rm = Instance.new("Model", game.Workspace.CurrentCamera)
- rm.Name = "FlyRopes"
- local ropes = {}
- for _, v in pairs(game.Workspace:GetChildren()) do
- for _, r in pairs(v:GetChildren()) do
- 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
- local s = Instance.new("Part")
- 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
- local m = Instance.new("CylinderMesh", s)
- m.Scale = Vector3.new(tonumber(r.RopeConf.Thickness.Value),1,tonumber(r.RopeConf.Thickness.Value))
- ropes[#ropes+1]={s, r.Attachment0, r.Attachment1}
- end
- end
- end
- game:GetService("RunService"):BindToRenderStep("Ropes", Enum.RenderPriority.First.Value, (function()
- for _, v in pairs(ropes) do
- 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)
- 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)
- end
- end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement