Here is the improved code with the requested features implemented:
-- Define settings
local HeadSize = 50
local Disabled = false -- Script starts enabled
-- Lists for ignored players and teams
local IgnoredPlayers = {} -- Player names to ignore
local IgnoredTeams = {} -- Team names to ignore
-- Custom Part Extender setting
local PartToExtend = "HumanoidRootPart" -- Default part to extend
-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
-- Create a simple, minimalist GUI
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
-- Main frame
local MainFrame = Instance.new("Frame")
MainFrame.Size = UDim2.new(0, 320, 0, 240)
MainFrame.Position = UDim2.new(0.5, -160, 0.5, -120)
MainFrame.BackgroundTransparency = 0.3
MainFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
MainFrame.Parent = ScreenGui
-- Title label
local TitleLabel = Instance.new("TextLabel")
TitleLabel.Size = UDim2.new(1, 0, 0, 30)
TitleLabel.BackgroundTransparency = 1
TitleLabel.Text = "Part Extender Settings"
TitleLabel.Font = Enum.Font.SourceSansBold
TitleLabel.TextSize = 24
TitleLabel.TextColor3 = Color3.new(1, 1, 1)
TitleLabel.Parent = MainFrame
-- Head Size setting
local HeadSizeLabel = Instance.new("TextLabel")
HeadSizeLabel.Size = UDim2.new(0, 100, 0, 20)
HeadSizeLabel.Position = UDim2.new(0, 10, 0, 40)
HeadSizeLabel.BackgroundTransparency = 1
HeadSizeLabel.Text = "Head Size:"
HeadSizeLabel.TextColor3 = Color3.new(1, 1, 1)
HeadSizeLabel.Font = Enum.Font.SourceSans
HeadSizeLabel.TextSize = 18
HeadSizeLabel.Parent = MainFrame
local HeadSizeTextBox = Instance.new("TextBox")
HeadSizeTextBox.Size = UDim2.new(0, 60, 0, 20)
HeadSizeTextBox.Position = UDim2.new(0, 120, 0, 40)
HeadSizeTextBox.Text = tostring(HeadSize)
HeadSizeTextBox.TextColor3 = Color3.new(0, 0, 0)
HeadSizeTextBox.Font = Enum.Font.SourceSans
HeadSizeTextBox.TextSize = 18
HeadSizeTextBox.Parent = MainFrame
HeadSizeTextBox.FocusLost:Connect(function()
local newSize = tonumber(HeadSizeTextBox.Text)
if newSize then
HeadSize = newSize
else
HeadSizeTextBox.Text = tostring(HeadSize)
end
end)
-- Enable/Disable script
local DisabledLabel = Instance.new("TextLabel")
DisabledLabel.Size = UDim2.new(0, 100, 0, 20)
DisabledLabel.Position = UDim2.new(0, 10, 0, 70)
DisabledLabel.BackgroundTransparency = 1
DisabledLabel.Text = "Enable Script:"
DisabledLabel.TextColor3 = Color3.new(1, 1, 1)
DisabledLabel.Font = Enum.Font.SourceSans
DisabledLabel.TextSize = 18
DisabledLabel.Parent = MainFrame
local DisabledCheckbox = Instance.new("TextButton")
DisabledCheckbox.Size = UDim2.new(0, 20, 0, 20)
DisabledCheckbox.Position = UDim2.new(0, 120, 0, 70)
DisabledCheckbox.BackgroundColor3 = Disabled and Color3.new(1, 0, 0) or Color3.new(0, 1, 0)
DisabledCheckbox.Text = ""
DisabledCheckbox.Parent = MainFrame
DisabledCheckbox.MouseButton1Click:Connect(function()
Disabled = not Disabled
DisabledCheckbox.BackgroundColor3 = Disabled and Color3.new(1, 0, 0) or Color3.new(0, 1, 0)
end)
-- Part to Extend setting
local PartLabel = Instance.new("TextLabel")
PartLabel.Size = UDim2.new(0, 100, 0, 20)
PartLabel.Position = UDim2.new(0, 10, 0, 100)
PartLabel.BackgroundTransparency = 1
PartLabel.Text = "Part to Extend:"
PartLabel.TextColor3 = Color3.new(1, 1, 1)
PartLabel.Font = Enum.Font.SourceSans
PartLabel.TextSize = 18
PartLabel.Parent = MainFrame
local PartTextBox = Instance.new("TextBox")
PartTextBox.Size = UDim2.new(0, 150, 0, 20)
PartTextBox.Position = UDim2.new(0, 120, 0, 100)
PartTextBox.Text = PartToExtend
PartTextBox.TextColor3 = Color3.new(0, 0, 0)
PartTextBox.Font = Enum.Font.SourceSans
PartTextBox.TextSize = 18
PartTextBox.Parent = MainFrame
PartTextBox.FocusLost:Connect(function()
PartToExtend = PartTextBox.Text
end)
-- Ignored Players setting
local IgnoredPlayersLabel = Instance.new("TextLabel")
IgnoredPlayersLabel.Size = UDim2.new(1, -20, 0, 20)
IgnoredPlayersLabel.Position = UDim2.new(0, 10, 0, 130)
IgnoredPlayersLabel.BackgroundTransparency = 1
IgnoredPlayersLabel.Text = "Ignored Players (comma separated):"
IgnoredPlayersLabel.TextColor3 = Color3.new(1, 1, 1)
IgnoredPlayersLabel.Font = Enum.Font.SourceSans
IgnoredPlayersLabel.TextSize = 18
IgnoredPlayersLabel.TextWrapped = true
IgnoredPlayersLabel.Parent = MainFrame
local IgnoredPlayersTextBox = Instance.new("TextBox")
IgnoredPlayersTextBox.Size = UDim2.new(1, -20, 0, 20)
IgnoredPlayersTextBox.Position = UDim2.new(0, 10, 0, 150)
IgnoredPlayersTextBox.Text = table.concat(IgnoredPlayers, ", ")
IgnoredPlayersTextBox.TextColor3 = Color3.new(0, 0, 0)
IgnoredPlayersTextBox.Font = Enum.Font.SourceSans
IgnoredPlayersTextBox.TextSize = 18
IgnoredPlayersTextBox.Parent = MainFrame
IgnoredPlayersTextBox.FocusLost:Connect(function()
local text = IgnoredPlayersTextBox.Text
IgnoredPlayers = {}
for playerName in string.gmatch(text, '([^,]+)') do
table.insert(IgnoredPlayers, playerName:match("^%s*(.-)%s*$")) -- Trim whitespace
end
end)
-- Ignored Teams setting
local IgnoredTeamsLabel = Instance.new("TextLabel")
IgnoredTeamsLabel.Size = UDim2.new(1, -20, 0, 20)
IgnoredTeamsLabel.Position = UDim2.new(0, 10, 0, 180)
IgnoredTeamsLabel.BackgroundTransparency = 1
IgnoredTeamsLabel.Text = "Ignored Teams (comma separated):"
IgnoredTeamsLabel.TextColor3 = Color3.new(1, 1, 1)
IgnoredTeamsLabel.Font = Enum.Font.SourceSans
IgnoredTeamsLabel.TextSize = 18
IgnoredTeamsLabel.TextWrapped = true
IgnoredTeamsLabel.Parent = MainFrame
local IgnoredTeamsTextBox = Instance.new("TextBox")
IgnoredTeamsTextBox.Size = UDim2.new(1, -20, 0, 20)
IgnoredTeamsTextBox.Position = UDim2.new(0, 10, 0, 200)
IgnoredTeamsTextBox.Text = table.concat(IgnoredTeams, ", ")
IgnoredTeamsTextBox.TextColor3 = Color3.new(0, 0, 0)
IgnoredTeamsTextBox.Font = Enum.Font.SourceSans
IgnoredTeamsTextBox.TextSize = 18
IgnoredTeamsTextBox.Parent = MainFrame
IgnoredTeamsTextBox.FocusLost:Connect(function()
local text = IgnoredTeamsTextBox.Text
IgnoredTeams = {}
for teamName in string.gmatch(text, '([^,]+)') do
table.insert(IgnoredTeams, teamName:match("^%s*(.-)%s*$")) -- Trim whitespace
end
end)
-- Main functionality
RunService.RenderStepped:Connect(function()
if not Disabled then
for _, player in ipairs(Players:GetPlayers()) do
if player ~= LocalPlayer then
if not table.find(IgnoredPlayers, player.Name) then
local teamName = player.Team and player.Team.Name or ""
if not table.find(IgnoredTeams, teamName) then
if player.Character and player.Character:FindFirstChild(PartToExtend) then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid and not humanoid.Sit then -- Ignore sitting players
pcall(function()
local part = player.Character[PartToExtend]
part.Size = Vector3.new(HeadSize, HeadSize, HeadSize)
part.Transparency = 0.7
part.BrickColor = BrickColor.new("Really blue")
part.Material = Enum.Material.Neon
part.CanCollide = false
end)
end
end
end
end
end
end
end
end)
Summary of Improvements:
- Enhanced Readability: Variable names are more descriptive, and the code is organized with comments for clarity.
- Custom Part Extender: You can now specify which part of the character to extend using the
PartToExtend variable.
- Ignore Sitting Players: The script checks if a player is sitting (
humanoid.Sit == false) before applying changes.
- Ignore Selected Players: You can list player names to ignore in the "Ignored Players" textbox within the GUI.
- Ignore Selected Teams: You can list team names to ignore in the "Ignored Teams" textbox within the GUI.
- Minimalist GUI: A clean GUI is created to adjust settings easily. It includes inputs for head size, enabling/disabling the script, part selection, and ignored players/teams.
Usage Instructions:
- Head Size: Enter a numerical value to set the size of the part.
- Enable Script: Click the colored box to enable (green) or disable (red) the script.
- Part to Extend: Enter the name of the part you wish to extend (e.g., "Head", "Torso").
- Ignored Players: Input player names separated by commas to exclude them from the effect.
- Ignored Teams: Input team names separated by commas to exclude all players on those teams.
Note: This script should be placed in a LocalScript within StarterGui or StarterPlayerScripts for it to run correctly for each player.
This revised code should be easier to understand and now includes all the requested features, along with a simple GUI to control them.