Advertisement
Mautiku

No collision FE

Feb 14th, 2025
1,702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. --No obfuscated now, are you happy?
  2.  
  3. local Players = game:GetService("Players")
  4. local RunService = game:GetService("RunService")
  5. local LocalPlayer = Players.LocalPlayer
  6.  
  7. local CHECK_INTERVAL = 0.1
  8. local DIST_THRESHOLD = 20
  9. local Enabled = true
  10.  
  11. local function getHRP(character)
  12. return character and character:FindFirstChild("HumanoidRootPart")
  13. end
  14.  
  15. local localHRP = nil
  16. local function onCharacterAdded(character)
  17. localHRP = getHRP(character)
  18. end
  19.  
  20. LocalPlayer.CharacterAdded:Connect(onCharacterAdded)
  21. if LocalPlayer.Character then
  22. onCharacterAdded(LocalPlayer.Character)
  23. end
  24.  
  25. local accumulated = 0
  26. RunService.Heartbeat:Connect(function(dt)
  27. if not Enabled then return end -- ถ้าปิดระบบ ไม่ทำงาน
  28.  
  29. accumulated = accumulated + dt
  30. if accumulated < CHECK_INTERVAL then return end
  31. accumulated = 0
  32.  
  33. if not localHRP then return end
  34. local localPos = localHRP.Position
  35.  
  36. for _, player in ipairs(Players:GetPlayers()) do
  37. if player ~= LocalPlayer and player.Character then
  38. local otherHRP = getHRP(player.Character)
  39. if otherHRP then
  40. local dist = (otherHRP.Position - localPos).Magnitude
  41. local shouldCollide = true
  42. if dist < DIST_THRESHOLD then
  43. shouldCollide = false
  44. end
  45. -- อัปเดทเฉพาะตอนที่เปลี่ยนแปลง
  46. for _, part in ipairs(player.Character:GetDescendants()) do
  47. if part:IsA("BasePart") and part.CanCollide ~= shouldCollide then
  48. part.CanCollide = shouldCollide
  49. end
  50. end
  51. end
  52. end
  53. end
  54. end)
  55.  
  56. _G.ToggleNoCollision = function(state)
  57. Enabled = state
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement