Having issues with sizing the HumanoidRootPart

Hey.

I’m making a kind-of-meme game, where the joke is that you’re playing with hacks. One of the said hacks is HBE or Hit-Box Expander. When HBE is enabled the other player’s HumanoidRootPart is resized so you can hit them in more places. I tried it in a normal script, and everything worked well except for the fact that the HumanoidRootPart made the users hover on the ground a bit. So I thought I could make it work in a LocalScript.

I copy and pasted it word for word in a LocalScript (seen below) but an error reading " [ HumanoidRootPart is not a valid member of Model “Workspace.Player2”]"

print(game.Players.LocalPlayer.Name)

game.Players.PlayerAdded:Connect(function(plyr)
	print(plyr)
	if game.Players.LocalPlayer.Name == plyr.Name then
		print("e")	
	else
		plyr.CharacterAdded:Connect(function(char)
			
			char.HumanoidRootPart.Transparency = 0.8
			char.HumanoidRootPart.Color = Color3.new(0.105882, 0, 0.92549)
			char.HumanoidRootPart.Size = Vector3.new(10,5,10)
		end)
	end
end)

Thanks for helping.

EDIT: Now no error shows up at all, it’s really strange, but the script does nothing.

2 Likes

Just to be clear, this is in StarterPlayerScripts? Also, are you just trying to resize the HumanoidRootPart of the local player, or everyone in the server?

You don’t need PlayerAdded if this is a localscript. Player can already be defined in a variable with Players.LocalPlayer. Make sure that you wait until their character is actually loaded before trying to modify it.

local plr = game:GetService("Players").LocalPlayer

plr.CharacterAdded:Connect(function(char)
    char.HumanoidRootPart.Transparency = 0.8
    char.HumanoidRootPart.Color = Color3.new(0.105882, 0, 0.92549)
    char.HumanoidRootPart.Size = Vector3.new(10,5,10)
end)


Everybody has theirs expanded, not just the local player.

You’re trying to use PlayerAdded in a local script, which doesn’t run for the client/player it’s running under. There’s no reason for you to use PlayerAdded here if you already have the LocalPlayer

If this is a localscript running on everyone’s individual client then everyone will have theirs expanded. Localscripts run on every single client. They’re not like serverscripts where you have to run the resizing code for every single player with a PlayerAdded event.