TKFP

Untitled

May 28th, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local uis = game:GetService("UserInputService")
  3. local replicatedStorage = game:GetService("ReplicatedStorage")
  4.  
  5. -- Buat BindableEvent jika belum ada
  6. if not replicatedStorage:FindFirstChild("ForceMouseReset") then
  7. local event = Instance.new("BindableEvent", replicatedStorage)
  8. event.Name = "ForceMouseReset"
  9. end
  10.  
  11. local function lockMouse()
  12. uis.MouseBehavior = Enum.MouseBehavior.LockCenter
  13. end
  14.  
  15. local function unlockMouse()
  16. uis.MouseBehavior = Enum.MouseBehavior.Default
  17. end
  18.  
  19. -- Respon ke event reset
  20. replicatedStorage:WaitForChild("ForceMouseReset").Event:Connect(function()
  21. unlockMouse()
  22. wait(0.1)
  23. lockMouse()
  24. end)
  25.  
  26. -- Auto re-lock setiap tool dipegang
  27. player.CharacterAdded:Connect(function(char)
  28. char.ChildAdded:Connect(function(tool)
  29. if tool:IsA("Tool") then
  30. wait(0.1)
  31. lockMouse()
  32.  
  33. tool.Unequipped:Connect(function()
  34. unlockMouse()
  35. end)
  36. end
  37. end)
  38. end)
  39.  
  40. local replicatedStorage = game:GetService("ReplicatedStorage")
  41. replicatedStorage:WaitForChild("ForceMouseReset"):Fire()
Advertisement
Add Comment
Please, Sign In to add comment