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)