Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Model0 = Instance.new("Model", script)
- script.Name = "CentOM"
- Part1 = Instance.new("Part")
- Part2 = Instance.new("Part")
- Part3 = Instance.new("Part")
- Model0.Name = "COM"
- Model0.PrimaryPart = Part1
- Part1.Name = "XPlane"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(-0.140193939, 0, -13.3988838, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Position = Vector3.new(-0.14019393920898438, 0, -13.398883819580078)
- Part1.Color = Color3.new(1, 0, 0)
- Part1.Size = Vector3.new(4, 0.5, 0.5)
- Part1.Anchored = true
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Really red")
- Part1.CanCollide = false
- Part1.Locked = true
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Really red")
- Part1.Shape = Enum.PartType.Cylinder
- Part2.Name = "YPlane"
- Part2.Parent = Model0
- Part2.CFrame = CFrame.new(-0.140193939, 0, -13.3988838, -4.37113883e-08, -1, 0, 1, -4.37113883e-08, 0, 0, 0, 1)
- Part2.Orientation = Vector3.new(0, 0, 90)
- Part2.Position = Vector3.new(-0.14019393920898438, 0, -13.398883819580078)
- Part2.Rotation = Vector3.new(0, 0, 90)
- Part2.Color = Color3.new(0, 1, 0)
- Part2.Size = Vector3.new(4, 0.5, 0.5)
- Part2.Anchored = true
- Part2.BottomSurface = Enum.SurfaceType.Smooth
- Part2.BrickColor = BrickColor.new("Lime green")
- Part2.CanCollide = false
- Part2.Locked = true
- Part2.TopSurface = Enum.SurfaceType.Smooth
- Part2.brickColor = BrickColor.new("Lime green")
- Part2.Shape = Enum.PartType.Cylinder
- Part3.Name = "ZPlane"
- Part3.Parent = Model0
- Part3.CFrame = CFrame.new(-0.140193939, 0, -13.3988838, -4.37113883e-08, 0, 1, 0, 1, 0, -1, 0, -4.37113883e-08)
- Part3.Orientation = Vector3.new(0, 90, 0)
- Part3.Position = Vector3.new(-0.14019393920898438, 0, -13.398883819580078)
- Part3.Rotation = Vector3.new(0, 90, 0)
- Part3.Color = Color3.new(0, 0, 1)
- Part3.Size = Vector3.new(4, 0.5, 0.5)
- Part3.Anchored = true
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.BrickColor = BrickColor.new("Really blue")
- Part3.CanCollide = false
- Part3.Locked = true
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.brickColor = BrickColor.new("Really blue")
- Part3.Shape = Enum.PartType.Cylinder
- local remt = Instance.new("RemoteFunction", owner.PlayerGui)
- remt.OnServerInvoke = function(p, COM)
- Model0:PivotTo(COM)
- end
- NLS([[
- print(script.Parent.Name)
- local COM = workspace.CurrentCamera:FindFirstChild("COM")
- if not COM then
- COM = workspace.CentOM.COM
- COM.Parent = workspace.CurrentCamera
- end
- local char = owner.Character
- local Humanoid = char.Humanoid
- local rootPart = char:WaitForChild("HumanoidRootPart")
- local UIS = game:GetService("UserInputService")
- local remt = script.Parent.RemoteFunction
- game:GetService("RunService").RenderStepped:Connect(function()
- if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter and not Humanoid.Sit then
- local cx, cy, cz = workspace.CurrentCamera.CFrame:ToOrientation()
- local rx, ry, rz = rootPart.CFrame:ToOrientation()
- local rotRoot = CFrame.fromOrientation(rx, cy, rz) + rootPart.Position
- local pos = rotRoot:PointToWorldSpace(rootPart.CFrame:PointToObjectSpace(rootPart.AssemblyCenterOfMass))
- remt:InvokeServer(rotRoot.Rotation + pos)
- else
- remt:InvokeServer(rootPart.CFrame.Rotation + rootPart.AssemblyCenterOfMass)
- end
- end)
- ]])
Advertisement
Advertisement