Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. local hitboxName         = "HumanoidRootPart"
  2. local hitboxCollides     = false
  3. local hitboxTransparency = 0
  4. local hitboxSizeLarge    = Vector3.new(20, 20, 1)
  5. local hitboxSizeNormal   = Vector3.new(2, 2, 1)
  6.  
  7.  
  8.  
  9.  
  10.  
  11. local players = game:GetService("Players")
  12. local runService = game:GetService("RunService")
  13. local inputService = game:GetService("UserInputService")
  14. local player = players.LocalPlayer
  15.  
  16. local properties = {
  17.     CanCollide   = hitboxCollides,
  18.     Transparency = hitboxTransparency,
  19.     Size         = hitboxSizeLarge,
  20. }
  21.  
  22.  
  23.  
  24.  
  25.  
  26. runService.Heartbeat:connect(function()
  27.     local character      = player.Character
  28.     local rootPart       = character and character.PrimaryPart
  29.     local hitboxPosition = rootPart and (rootPart.Position + Vector3.new(0,0,6))
  30.     if typeof(hitboxPosition) ~= "Vector3" then
  31.         return
  32.     end
  33.     for _, otherPlayer in pairs(players:GetPlayers()) do
  34.         if otherPlayer ~= player then
  35.             local character = otherPlayer.Character
  36.             if character and character.Parent then
  37.                 local hitbox = character:FindFirstChild(hitboxName)
  38.                 if hitbox and hitbox:IsA("BasePart") then
  39.                     for property, value in pairs(properties) do
  40.                         hitbox[property] = value
  41.                     end
  42.                     hitbox.Position = hitboxPosition
  43.                 end
  44.             end
  45.         end
  46.     end
  47. end)
  48.  
  49. inputService.InputBegan:connect(function(input, wasProcessed)
  50.     if wasProcessed then return end
  51.     if input.UserInputType == Enum.UserInputType.Keyboard then
  52.         if input.KeyCode == Enum.KeyCode.H then
  53.             if properties.Size == hitboxSizeLarge then
  54.                 properties.Size = hitboxSizeNormal
  55.             else
  56.                 properties.Size = hitboxSizeLarge
  57.             end
  58.         elseif input.KeyCode == Enum.KeyCode.J then
  59.             properties.CanCollide = not properties.CanCollide
  60.         elseif input.KeyCode == Enum.KeyCode.K then
  61.             properties.Transparency = math.clamp(properties.Transparency - 0.1, 0, 1)
  62.         elseif input.KeyCode == Enum.KeyCode.L then
  63.             properties.Transparency = math.clamp(properties.Transparency + 0.1, 0, 1)
  64.         end
  65.     end
  66. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement