ColdSpecs

Transparent head

Sep 24th, 2023
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. -- Settings
  2. local settings = {
  3. headScale = Vector3.new(5, 5, 5) -- The fixed size of the head parts
  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) -- A function that changes the size of a head part
  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. object.Transparency = 0.5 -- Set the transparency of the head part to 0.5 (half-transparent)
  19. end
  20. end
  21.  
  22. local function updateHeadSize(player) -- A function that updates the size of a player's head part
  23. local character = player.Character or player.CharacterAdded:Wait() -- Get the player's character
  24. local head = character:FindFirstChild("Head") -- Get the head part of the character
  25. if head and head:IsA("Part") then
  26. if newSizes[head] then -- Check if the head has a new size stored in the table
  27. local size = newSizes[head]
  28. head.Size = size
  29. end
  30. end
  31. end
  32.  
  33. local function checkHeads() -- A function that checks all the heads in the workspace and changes their size
  34. local models = workspace:GetChildren() -- Get all the models in the workspace
  35. local heads = {} -- A table to store all the head parts
  36. for _, model in pairs(models) do -- Loop through all the models
  37. if model:IsA("Model") and model:FindFirstChild("Head") then -- Check if the model has a head part
  38. local head = model.Head
  39. table.insert(heads, head) -- Add the head part to the table
  40. end
  41. end
  42.  
  43. for _, head in pairs(heads) do -- Loop through all the head parts
  44. changeHeadSize(head) -- Call the function to change the head size
  45. end
  46.  
  47. end
  48.  
  49. -- Main
  50.  
  51. checkHeads() -- Call the function once at the start
  52.  
  53. game.Players.PlayerAdded:Connect(function(player) -- Connect the function to the PlayerAdded event
  54. updateHeadSize(player) -- Call the function to update the head size
  55.  
  56. player.CharacterAdded:Connect(function() -- Connect the function to the CharacterAdded event
  57. updateHeadSize(player) -- Call the function to update the head size
  58.  
  59. end)
  60.  
  61. end)
  62.  
  63. workspace.ChildAdded:Connect(function(child) -- Connect the function to the ChildAdded event
  64.  
  65. if child:IsA("Model") and child:FindFirstChild("Head") then -- Check if the child is a model with a head part
  66.  
  67. local head = child.Head
  68.  
  69. changeHeadSize(head) -- Call the function to change the head size
  70.  
  71. end
  72.  
  73. end)
  74.  
  75. workspace.ChildRemoved:Connect(function(child) -- Connect the function to the ChildRemoved event
  76.  
  77. if child:IsA("Model") and child:FindFirstChild("Head") then -- Check if the child is a model with a head part
  78.  
  79. local head = child.Head
  80.  
  81. newSizes[head] = nil
  82.  
  83. end
  84.  
  85. end)
  86.  
  87. userInputService.InputBegan:Connect(function(inputObject, gameProcessedEvent)
  88.  
  89. if gameProcessedEvent then return end
  90.  
  91. local keyCode = inputObject.KeyCode -- Get which key was pressed
  92.  
  93. if keyCode == Enum.KeyCode.Q then -- Keybind
  94.  
  95. settings.headScale = Vector3.new(8, 8, 8) -- Units
  96.  
  97. checkHeads() -- Update all heads
  98.  
  99. elseif keyCode == Enum.KeyCode.T then -- Keybind
  100.  
  101. settings.headScale = Vector3.new(5.2, 5.2, 5.2) -- Units
  102.  
  103. checkHeads() -- Update all heads
  104.  
  105. elseif keyCode == Enum.KeyCode.Z then -- Keybind
  106.  
  107. settings.headScale = Vector3.new(1, 1, 1) -- Units
  108.  
  109. checkHeads() -- Update all heads
  110.  
  111. elseif keyCode == Enum.KeyCode.F then -- Keybind
  112.  
  113. settings.headScale = Vector3.new(13, 13, 13) -- Units
  114.  
  115. checkHeads() -- Update all heads
  116.  
  117. end
  118.  
  119. end)
  120.  
Advertisement
Add Comment
Please, Sign In to add comment