Nothing happening in a script

I am making this script which adds a back part as a hitbox to the player’s humanoid root part, but it doesn’t work

local backbox = script.Parent

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local character = player.Character

if not character or not character.Parent then

character = player.CharacterAdded:wait()

end

wait(1)

if character then

local hrp = character.HumanoidRootPart

local weld = Instance.new("Weld")

weld.Part0 = hrp

weld.Part1 = backbox

weld.Parent = script.Parent

backbox.Position = hrp

end

Any help is appreciated.

1 Like

You never defined part0 anywhere in the script also, where is the script

The part is in workspace while it is the parent of the local script. I did define part0 as hrp

Where is this script located in the game?

Im stupid, just ignore when i said you never defined part 0. Is the local script under the workspace?
also im not sure if you are changing the position of part0, you are only parenting it under the humanoid root part, and not changing the position. Im not on my computer right now so i dont remember if it automatically moves the attachment under the parent

If the script is under server storage or replicated storage it wont run

image

I changed the position too, in the third last line

yea a local script should alway be in starter character or started player

1 Like

for some reason i cannot see you’re image but try making the script in the started character or starter player

1 Like

I got this message: " Unable to assign property Position. Vector3 expected, got Instance - Client - HitBoxSetup:20"

you want to make a part on the humanoid right and welded to it right?

Yes, I am dividing the player’s hitbox in 2, the front and back

Fixed it, needed to change the part’s parent to the character

oh well, that’s a good thing! happy to have tried to help you

1 Like