Script doesn't work

I am trying to make a script that will create a small hitbox and make it follow you around. It doesn’t write anything in the output. I have no idea why it doesn’t work.

	local clone = game.Workspace.Hitbox:Clone()
	while true do
		wait(.1)
		clone.Position = game.Workspace[plr.Name].HumanoidRootPart.Position
	end
end)

Hey @R1borisoff!

So aside from the fact that this post isn’t as thorough as it could be, I actually have your answer!

The reason it’s not working is because when you :Clone() something it’s parent is not set to the parent of the original. You have to manually set the parent after creation.

That would look like this for you:

local clone = game.Workspace.Hitbox:Clone()
clone.Parent = workspace
while true do
	wait(.1)
	clone.Position = game.Workspace[plr.Name].HumanoidRootPart.Position
end
2 Likes

Nevermind, I just had to add a
clone.Parent = workspace

1 Like