Advertisement
eruaaaaaaa

Untitled

Mar 24th, 2022 (edited)
1,052
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. local function getMousePosition()
  2. local mouselocation = game:GetService("UserInputService"):GetMouseLocation();
  3. local mouseRay = workspace.CurrentCamera.ViewportPointToRay(workspace.CurrentCamera, mouselocation.X, mouselocation.Y);
  4. local raycast = workspace:Raycast(mouseRay.Origin, mouseRay.Direction.Unit);
  5. local position = nil;
  6. if raycast then position = raycast.Position else position = mouseRay.Origin + (mouseRay.Direction.Unit) end
  7. return position
  8. end
  9.  
  10. local function getMousePosition2()
  11. local players = game.GetService(game, "Players")
  12. local client = players.LocalPlayer
  13. local mouse = client.GetMouse(client)
  14. local mouselocation = Vector2.new(mouse.X, mouse.Y)
  15. local params = RaycastParams.new(); params.FilterType = Enum.RaycastFilterType.Blacklist; params.FilterDescendantsInstances = {client.Character}
  16. local mouseRay = workspace.CurrentCamera.ScreenPointToRay(workspace.CurrentCamera, mouselocation.X, mouselocation.Y, 1);
  17. local raycast = workspace:Raycast(mouseRay.Origin, mouseRay.Direction * 500, params);
  18. local position = nil;
  19. if raycast then position = raycast.Position else position = mouseRay.Origin + (mouseRay.Direction.Unit) end
  20. return position
  21. end
  22.  
  23.  
  24. local old; old = hookmetamethod(game, "__namecall", function(self, ...)
  25. local args = {...}
  26.  
  27. if tostring(self) == "Screen" then
  28. args[1][10] = getMousePosition();
  29. return self.FireServer(self, unpack(args));
  30. elseif tostring(self) == "spectate" and args[1] == "updateCamera" then -- th3lt
  31. args[2][3] = getMousePosition2();
  32. return self.FireServer(self, unpack(args));
  33. elseif tostring(self) == "UpdateSpec" then -- snowcore pveye
  34. args[2] = getMousePosition2();
  35. return self.FireServer(self, unpack(args));
  36. elseif tostring(self) == "ScreenWatch" then -- bear pveye
  37. if #args[1] == 3 then
  38. args[1][2] = getMousePosition();
  39. end
  40. --return self.FireServer(self, unpack(args));
  41. end
  42.  
  43. return old(self, ...)
  44. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement