Advertisement
ColdSpecs

Original keybind

Sep 24th, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. -- Settings
  2. local settings = {
  3. headScale = Vector3.new(5, 5, 5)
  4. }
  5.  
  6. -- Variables
  7. local plr = game:GetService("Players").LocalPlayer
  8. local newSizes = {} -- A table to store the new sizes of the heads
  9. local userInputService = game:GetService("UserInputService") -- Get the UserInputService
  10.  
  11. -- Functions
  12. local function changeHeadSize(object)
  13. if object and object:IsA("Part") then
  14. local originalSize = object.Size
  15. local newSize = settings.headScale -- Use the fixed size here instead of adding to the original size
  16. object.Size = newSize
  17. newSizes[object] = newSize -- Store the new size in the table using the object as a key
  18. end
  19. end
  20.  
  21. local function updateHeadSize(player)
  22. local character = player.Character or player.CharacterAdded:Wait()
  23. local head = character:FindFirstChild("Head")
  24. if head and head:IsA("Part") then
  25. if newSizes[head] then -- Check if the head has a new size stored in the table
  26. local size = newSizes[head]
  27. head.Size = size
  28. end
  29. end
  30. end
  31.  
  32. local function checkHeads()
  33. local models = workspace:GetChildren() -- Get all the models in the workspace
  34. local heads = {} -- A table to store all the head parts
  35. for _, model in pairs(models) do -- Loop through all the models
  36. if model:IsA("Model") and model:FindFirstChild("Head") then -- Check if the model has a head part
  37. local head = model.Head
  38. table.insert(heads, head) -- Add the head part to the table
  39. end
  40. end
  41. for _, head in pairs(heads) do -- Loop through all the head parts
  42. changeHeadSize(head) -- Call the function to change the head size
  43. end
  44. end
  45.  
  46. -- Main
  47. checkHeads() -- Call the function once at the start
  48.  
  49. game.Players.PlayerAdded:Connect(function(player) -- Connect the function to the PlayerAdded event
  50. updateHeadSize(player) -- Call the function to update the head size
  51. player.CharacterAdded:Connect(function() -- Connect the function to the CharacterAdded event
  52. updateHeadSize(player) -- Call the function to update the head size
  53. end)
  54. end)
  55.  
  56. workspace.ChildAdded:Connect(function(child) -- Connect the function to the ChildAdded event
  57. if child:IsA("Model") and child:FindFirstChild("Head") then -- Check if the child is a model with a head part
  58. local head = child.Head
  59. changeHeadSize(head) -- Call the function to change the head size
  60. end
  61. end)
  62.  
  63. workspace.ChildRemoved:Connect(function(child) -- Connect the function to the ChildRemoved event
  64. if child:IsA("Model") and child:FindFirstChild("Head") then -- Check if the child is a model with a head part
  65. local head = child.Head
  66. newSizes[head] = nil
  67. end
  68. end)
  69.  
  70. userInputService.InputBegan:Connect(function(inputObject, gameProcessedEvent)
  71. if gameProcessedEvent then return end
  72. local keyCode = inputObject.KeyCode -- Get which key was pressed
  73. if keyCode == Enum.KeyCode.Q then -- Keybind
  74. settings.headScale = Vector3.new(8, 8, 8) -- Units
  75. checkHeads() -- Update all heads
  76. elseif keyCode == Enum.KeyCode.T then -- Keybind
  77. settings.headScale = Vector3.new(5.2, 5.2, 5.2) -- Units
  78. checkHeads() -- Update all heads
  79. elseif keyCode == Enum.KeyCode.Z then -- Keybind
  80. settings.headScale = Vector3.new(1, 1, 1) -- Units
  81. checkHeads() -- Update all heads
  82. elseif keyCode == Enum.KeyCode.F then -- Keybind
  83. settings.headScale = Vector3.new(13, 13, 13) -- Units
  84. checkHeads() -- Update all heads
  85. end
  86. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement