Issue with my script, BodyPosition not part of part?

So I’m trying to make a part and then using it’s bodyposition/gryo fire it at the mouse position. Sort of like a bullet, but in my case different purpose. But anyway, create a part and shoot it at the mouse position. Right now it creates the part, but it just flys along the ground. What am I doing wrong here?

Body gryo/position images:

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
MousePos = Mouse.Hit
local debounce = false

function Press(key)
	if (key ~= "f") or debounce == true then return end
		debounce = true
		local createEffect ="Part")
		createEffect.Parent = workspace
		createEffect.Anchored = false
		createEffect.Transparency = 0
		createEffect.Name = "Can"

		local contents = script:GetChildren()
		for i = 1,#contents do
			local cloner = contents[i]:Clone()
			cloner.Parent = createEffect
		createEffect.BodyPosition.Position = MousePos.Position
	debounce = false	

1 Like

Body movers are deprecated in favor of force constraints. You would use AlignPosition instead as it gives more control and better physics stability. Give that a go and tell me how it works out.

Turns out my

MousePos = Mouse.Hit

Was outside the function, so it was only declared once. But I’ll keep that in mind thanks.

That happens sometimes. Don’t forget to mark a post as a solution when your issue is resolved (usually as to avoid further replies).

In this instance you should mark your own post as the solution as that is what resolved the initial issue.