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:
https://gyazo.com/fa1f64badff0a8e40ec8877218742f8c
https://gyazo.com/bb676c3878f7c0a1010c1aed2f577c80

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
	
		print("fire")
		debounce = true
		
		local createEffect = Instance.new("Part")
		createEffect.Parent = workspace
		createEffect.Anchored = false
		createEffect.Transparency = 0
		createEffect.CFrame=game.Players.LocalPlayer.Character.Torso.CFrame*CFrame.new(0,0,-3)
		createEffect.Name = "Can"
	


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

	Mouse.KeyDown:connect(Press)
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.