Why isn't the position of this part being set correctly?

Hi, I’m making a mining system and to add detail I wanted to make it look like you would “Chip away” the ore you were mining. So whenever you were to hit the ore, it would clone it and divide the size by 5 and set it’s position to 5 studs above the original ore. But for some reason, this isn’t the case, it just stays at the original ores position instead of moving up 5 studs. I’m not sure why this is happening, here is the code:

local debounce = false
game.ReplicatedStorage.OnSwing.OnServerEvent:Connect(function(player, Hitpart, Sound)
	Hitpart.Touched:Connect(function(hit)
		if hit.Parent.Name == "Ores" then
			if debounce == false then
				debounce = true
				print("Hit")
				Sound:Play()
				local SmallPart = hit:Clone()
				SmallPart.Anchored = false
				SmallPart.Size = hit.Size/5
				SmallPart.Position = Vector3.new(Hitpart.Position + Vector3.new(0,5,0))
				SmallPart.Parent = workspace
				wait(Sound.TimeLength)
				debounce = false
			end
		end
	end)
end)
1 Like

Try changing it to SmallPart.Position = Hitpart.Position + Vector3.new(0, 5, 0)

1 Like

Just stays in Hitpart’s position instead of moving up 5 studs.

1 Like
  1. It’s anchored
  2. Is it trying to move it into a part?

This is just me but I would set the CFrame of it instead of Position.

1 Like

No, the part that it’s trying to move from is anchored. But it’s trying to move into free space, there shouldn’t be anything blocking it unless the fact that the part its coming from is anchored.

I’ve already tried that.

1 Like

Maybe there’s a weld inside the part? also like @MrLonely1221 said using cframe is better
try:

local SmallPart = hit:Clone()
SmallPart.Anchored = false
SmallPart.Size = hit.Size/5
SmallPart.CanCollide = false
for _, i in pairs(SmallPart:GetChildren() do
 if i.className == 'Weld' then
  i:Destroy()
 end
end
SmallPart.CFrame = CFrame.new(Hitpart.Position + Vector3.new(0,5,0))
SmallPart.Parent = workspace
wait(Sound.TimeLength)
3 Likes