How can i change the position of the tools which are dropped by an enemy after he dies? Currently if he drops multiple tools at once they kind of stack inside of eachother.
dropBlock.Handle.CFrame = (position)
wait(.2)
local anchor = Instance.new("Part")
anchor.Name = "AnchorPart"
anchor.Size = Vector3.new(2, 2, 2)
anchor.Transparency = 1
anchor.Anchored = true
anchor.CanCollide = false
anchor.Parent = model
anchor.CFrame = CFrame.new(dropBlock.Handle.Position) * CFrame.new(0, 1.5, 0)
if player.Character then
anchor.CFrame = CFrame.new(anchor.Position, Vector3.new(
player.Character.Head.Position.X,
anchor.Position.Y,
player.Character.Head.Position.Z))
anchor.CFrame = anchor.CFrame * CFrame.Angles(0, math.pi * 2 * amountNum / amount, 0)
anchor.CFrame = anchor.CFrame * CFrame.new(0, 0, 3) -- Place it farther from the player
end
are you calling this in a loop? if you want to evenly space them in a radius about the player you might achieve that using this:
your immediate problem is you’re doing the same operation each time, set, angle, push away, so they’re all ending in the same location. Cheaper would be to +/- a random value in 2d along the XZ plane from the players’ position, but no guarantee the chosen location doesn’t appear inside the player or inside an existing anchor part. Perhaps you could raycast down from above the player to check a spot isn’t already occupied by the anchor though.