Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function getMousePosition()
- local mouselocation = game:GetService("UserInputService"):GetMouseLocation();
- local mouseRay = workspace.CurrentCamera.ViewportPointToRay(workspace.CurrentCamera, mouselocation.X, mouselocation.Y);
- local raycast = workspace:Raycast(mouseRay.Origin, mouseRay.Direction.Unit);
- local position = nil;
- if raycast then position = raycast.Position else position = mouseRay.Origin + (mouseRay.Direction.Unit) end
- return position
- end
- local function getMousePosition2()
- local players = game.GetService(game, "Players")
- local client = players.LocalPlayer
- local mouse = client.GetMouse(client)
- local mouselocation = Vector2.new(mouse.X, mouse.Y)
- local params = RaycastParams.new(); params.FilterType = Enum.RaycastFilterType.Blacklist; params.FilterDescendantsInstances = {client.Character}
- local mouseRay = workspace.CurrentCamera.ScreenPointToRay(workspace.CurrentCamera, mouselocation.X, mouselocation.Y, 1);
- local raycast = workspace:Raycast(mouseRay.Origin, mouseRay.Direction * 500, params);
- local position = nil;
- if raycast then position = raycast.Position else position = mouseRay.Origin + (mouseRay.Direction.Unit) end
- return position
- end
- local old; old = hookmetamethod(game, "__namecall", function(self, ...)
- local args = {...}
- if tostring(self) == "Screen" then
- args[1][10] = getMousePosition();
- return self.FireServer(self, unpack(args));
- elseif tostring(self) == "spectate" and args[1] == "updateCamera" then -- th3lt
- args[2][3] = getMousePosition2();
- return self.FireServer(self, unpack(args));
- elseif tostring(self) == "UpdateSpec" then -- snowcore pveye
- args[2] = getMousePosition2();
- return self.FireServer(self, unpack(args));
- elseif tostring(self) == "ScreenWatch" then -- bear pveye
- if #args[1] == 3 then
- args[1][2] = getMousePosition();
- end
- --return self.FireServer(self, unpack(args));
- end
- return old(self, ...)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement