Is this a good way to make all r15 characters with the same Hitbox?

If i’m in the wrong category sorry :frowning:

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

Hi, I try to make all the player character have the same hitbox in r15 for collision (and maybe for weapon)

  1. What is the issue? Include screenshots / videos if possible!

all r15 character don’t have the same size and some of them can go in area that other can’t because of their size

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

i try to make two character in one, one character is blocky character used for collision and the other one is the visual character (player apperance)

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

my goal is to make player able to have the character they want in r15 but make hitbox always the same

i have arleady a script that work but i don’t know if is bad and maybe cause problem and if it can be improve or if their a other ways that is better to do.

i don’t ask for a full code but a idea and a review if their some part of the code that need a better protection and how and why ?

Here the code i use :

function CharacterHandler.SetUp(Player, Char)
	
	local Hum = Char:WaitForChild("Humanoid")
	local Root = Char:WaitForChild("HumanoidRootPart")

	-- player character is for collision between player

	for _,bodypart in pairs(Char:GetChildren()) do
		
		if bodypart:IsA("BasePart") then
			bodypart.CollisionGroup = "PlayerCharacter"
		end
		
	end
	
	spawn(function()
		
		local VisualCharacter = script:WaitForChild("StarterCharacter"):Clone()
		VisualCharacter.Name = "VisualCharacter"
		
        -- visual character is for the visual character for it don't have any collision

		for _,bodypart in pairs(VisualCharacter:GetChildren()) do

			if bodypart:IsA("BasePart") then
				bodypart.CollisionGroup = "VisualCharacter"
			end

		end
		
		if Char then
			
			VisualCharacter.Parent = Char
			
			VisualCharacter.Humanoid:ApplyDescription(Players:GetHumanoidDescriptionFromUserId(Player.UserId))
			
			for _,bodypart in pairs(VisualCharacter:GetChildren()) do

				if bodypart:IsA("BasePart") then
					bodypart:SetNetworkOwner(Player)
					bodypart.Massless = true
				end

			end
			
			VisualCharacter:WaitForChild("Humanoid").AutoRotate = false
			VisualCharacter:WaitForChild("Humanoid").PlatformStand = true
			
			VisualCharacter:WaitForChild("HumanoidRootPart").CFrame = Root.CFrame - Vector3.new(0,(0.5 * Root.Size.Y) + Hum.HipHeight,0) + Vector3.new(0,(0.5 * VisualCharacter:WaitForChild("HumanoidRootPart").Size.Y) + VisualCharacter:WaitForChild("Humanoid").HipHeight,0)
			
			local Weld = Instance.new("WeldConstraint")
			Weld.Parent = VisualCharacter:WaitForChild("HumanoidRootPart")
			Weld.Part0 = Root
			Weld.Part1 = VisualCharacter:WaitForChild("HumanoidRootPart")
	
		end
		
	end)
	
	Hum.Died:Connect(function()
		task.wait(Players.RespawnTime)
		Player:LoadCharacter()
		CharacterHandler.SetUp(Player, Player.Character)
	end)
	
end

the player character is loaded outside the function in another code like this :

	Player:LoadCharacter()
	CharacterHandler.SetUp(Player, Player.Character)

and for the animation i use the default roblox animation, i only edited for it make the animation play on the visual character

Before Code:

After Code:

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

3 Likes

I don’t see anything wrong with the code you wrote, in my opinion it’s a great idea to let your player-base keep their avatars appearance while you simultaneously uphold the integrity of your game mechanics.

2 Likes