-- Returns a table of every possible bodypart in a character, or nil if the
character does not exist. local function getBodyParts(character) local humanoid = character:WaitForChild("Humanoid") local parts = { Head = character:WaitForChild("Head"), HumanoidRootPart = character:WaitForChild("HumanoidRootPart"), Humanoid = character:WaitForChild("Humanoid") } if humanoid.RigType == Enum.HumanoidRigType.R6 then parts.Torso = {Torso = character:WaitForChild("Torso")} parts["Left Arm"] = {LeftArm = character:WaitForChild("Left Arm")} parts["Right Arm"] = {RightArm = character:WaitForChild("Right Arm")} parts["Left Leg"] = {LeftLeg = character:WaitForChild("Left Leg")} parts["Right Leg"] = {RightLeg = character:WaitForChild("Right Leg")} elseif humanoid.RigType == Enum.HumanoidRigType.R15 then parts.Torso = { UpperTorso = character:WaitForChild("UpperTorso"), LowerTorso = character:WaitForChild("LowerTorso") } parts["Left Arm"] = { LeftHand = character:WaitForChild("LeftHand"), LeftLowerArm = character:WaitForChild("LeftLowerArm"), LeftUpperArm = character:WaitForChild("LeftUpperArm") } parts["Right Arm"] = { RightHand = character:WaitForChild("RightHand"), RightLowerArm = character:WaitForChild("RightLowerArm"), RightUpperArm = character:WaitForChild("RightUpperArm") } parts["Left Leg"] = { LeftFoot = character:WaitForChild("LeftFoot"), LeftLowerLeg = character:WaitForChild("LeftLowerLeg"), LeftUpperLeg = character:WaitForChild("LeftUpperLeg") } parts["Right Leg"] = { RightFoot = character:WaitForChild("RightFoot"), RightLowerLeg = character:WaitForChild("RightLowerLeg"), RightUpperLeg = character:WaitForChild("RightUpperLeg") } end return parts end
-- Main function that allows the character passed to be expanded at will
local function extendCharacter(character) local player = game.Players:GetPlayerFromCharacter(character) local timer = 0 local originals = {} local collisions = {} local CharacterAdded = {} local bodyParts = getBodyParts(character) --Sets up original sizes, creates collision constraints, and creates hooks to bypass localscript anticheats local function setup(i, v) if not originals[i] then originals[i] = {} originals[i].Size = v.Size originals[i].Transparency = v.Transparency originals[i].CanCollide = v.CanCollide originals[i].Massless = v.Massless local sizeHook = v:AddGetHook("Size", originals[i].Size) local transparencyHook = v:AddGetHook("Transparency", originals[i].Transparency) local canCollideHook = v:AddGetHook("CanCollide", originals[i].CanCollide) local masslessHook = v:AddGetHook("Massless", originals[i].Massless) v:AddSetHook("Size", function(self, value) originals[i].Size = value sizeHook:Modify("Size", value) return value end) v:AddSetHook("Transparency", function(self, value) originals[i].Transparency = value transparencyHook:Modify("Transparency", value) return value end) v:AddSetHook("CanCollide", function(self, value) originals[i].CanCollide = value canCollideHook:Modify("CanCollide", value) return value end) v:AddSetHook("Massless", function(self, value) originals[i].Massless = value masslessHook:Modify("Massless", value) return value end) end if not collisions[i] then collisions[i] = {} -- thanks to GameGuy#5286 for telling me collision constraints exist for o,b in pairs(getBodyParts(lPlayer.Character)) do if o ~= "Humanoid" and type(b) ~= "table" then collisions[i][o] = Instance.new("NoCollisionConstraint", v) collisions[i][o].Enabled = false collisions[i][o].Part0 = v collisions[i][o].Part1 = b CharacterAdded[i] = lPlayer.CharacterAdded:Connect(function(char) local temp = char:WaitForChild(o) collisions[i][o].Part1 = temp end) elseif type(b) == "table" then for g,z in pairs(b) do if z:IsA("BasePart") then collisions[i][g] = Instance.new("NoCollisionConstraint", v) collisions[i][g].Enabled = false collisions[i][g].Part0 = v collisions[i][g].Part1 = z CharacterAdded[i] = lPlayer.CharacterAdded:Connect(function(char) local temp = char:WaitForChild(g) if temp:IsA("BasePart") then collisions[i][g].Part1 = temp end end) end end end end end end do local customPart = character:FindFirstChild(customPartNameInput.Value) if customPart and customPart:IsA("BasePart") then if not originals[customPart.Name] then setup(customPart.Name, customPart) end end for i,v in pairs(bodyParts) do if i ~= "Humanoid" and type(v) ~= "table" then if not originals[i] then setup(i,v) end elseif type(v) == "table" then for o,b in pairs(v) do if not originals[o] then setup(o,b) end end end end end -- resets the properties of the selected part. -- if "all" is passed, will reset every part local function reset(part) if part == "custompart" or part == "all" then local customPart = character:FindFirstChild(customPartNameInput.Value) if customPart and customPart:IsA("BasePart") then customPart.Size = originals[customPart.Name].Size customPart.Transparency = originals[customPart.Name].Transparency customPart.CanCollide = originals[customPart.Name].CanCollide customPart.Massless = originals[customPart.Name].Massless end end for i,v in pairs(bodyParts) do if string.lower(part) == string.lower(i) or part == "all" then if i ~= "Humanoid" and type(v) ~= "table" then v.Size = originals[i].Size v.Transparency = originals[i].Transparency v.CanCollide = originals[i].CanCollide v.Massless = originals[i].Massless elseif type(v) == "table" then for o,b in pairs(v) do b.Size = originals[o].Size b.Transparency = originals[o].Transparency b.Massless = originals[o].Massless for _,z in pairs(collisions[o]) do if z.Enabled == true and z.Part0 == b then z.Enabled = false end end end end end end end local function getChecks() if bodyParts.Humanoid:GetState() == Enum.HumanoidStateType.Dead then return 2 end if extenderSitCheck.Value then if bodyParts.Humanoid.Sit then return 1 end end if ignoreSelfTeamToggled.Value then if game.PlaceId == 2039118386 then -- Neighborhood War local selfTeam local playerTeam pcall(function() selfTeam = lPlayer.Character.HumanoidRootPart.BrickColor playerTeam = bodyParts.HumanoidRootPart.BrickColor end) if selfTeam == playerTeam then return 1 end else if lPlayer.Team == player.Team then return 1 end end end if ignoreSelectedTeamsToggled.Value then local teamList = ignoreTeamList:GetActiveValues() if table.find(teamList, tostring(player.Team)) then return 1 end end if ignoreSelectedPlayersToggled.Value then local playerList = ignorePlayerList:GetActiveValues() if table.find(playerList, tostring(player.Name)) then return 1 end end return 0 end -- here's the actual expander code local Heartbeat Heartbeat = game:GetService("RunService").Heartbeat:Connect(function(deltaTime) timer += deltaTime if timer >= (extenderUpdateRate.Value / 100) then -- divided by 100 because milliseconds timer = 0 local bodyPartList = extenderPartList:GetActiveValues() local checks = getChecks() if checks == 2 then reset("all") for _,v in pairs(CharacterAdded) do v:Disconnect() end Heartbeat:Disconnect() return elseif checks == 1 then reset("all") return end if extenderToggled.Value then if table.find(bodyPartList, "Custom Part") then local customPart = character:FindFirstChild(customPartNameInput.Value) if customPart then customPart.Size = Vector3.new(extenderSize.Value, extenderSize.Value, extenderSize.Value) customPart.Transparency = extenderTransparency.Value customPart.CanCollide = false customPart.Massless = true end else reset("custompart") end for i,v in pairs(bodyParts) do if table.find(bodyPartList, i) then if type(v) ~= "table" then if i ~= "HumanoidRootPart" then v.Massless = true end v.Size = Vector3.new(extenderSize.Value, extenderSize.Value, extenderSize.Value) v.Transparency = extenderTransparency.Value v.CanCollide = false else for o,b in pairs(v) do b.Massless = true b.Size = Vector3.new(extenderSize.Value, extenderSize.Value, extenderSize.Value) b.Transparency = extenderTransparency.Value for _,z in pairs(collisions[o]) do if z.Enabled == false and z.Part0 == b then z.Enabled = true end end end end else reset(i) end end else reset("all") end end end) local PlayerRemoving PlayerRemoving = game.Players.PlayerRemoving:Connect(function(v) if v == player then Heartbeat:Disconnect() PlayerRemoving:Disconnect() end end) end for _,player in ipairs(game.Players:GetPlayers()) do if player ~= lPlayer then task.spawn(function() if player.Character then -- why use coroutine.wrap after I've been abusing task.spawn? fuck you that's why coroutine.wrap(extendCharacter)(player.Character) end player.CharacterAdded:Connect(function(v) coroutine.wrap(extendCharacter)(v) end) end) end end game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(v) coroutine.wrap(extendCharacter)(v) end) end) -- now, where are my schizo meds?