Issues with roblox's new body mover constraints

  1. What do you want to achieve? I want to achieve this effect: https://gyazo.com/64da931bcd068969ec181940de131322

  2. What is the issue? I have already achieved it in a separate test area but whenever I try to apply that to my actual game it doesn’t work

  3. What solutions have you tried so far? So in the test area this is the script I use in the testing (Separate) place which gives the effect I want:

local NewProjectile = script.Parent

local NewAttachment = Instance.new("Attachment")
NewAttachment.Parent = NewProjectile

local NewAttachment2 = script.Parent.Parent.Part2.Attachment1

local Scale = 1

local Force = Vector3.new(2*Scale,0 + 2*Scale,math.random(-2,2)*Scale)

local NewLineForce = Instance.new("LineForce")
NewLineForce.Enabled = false
NewLineForce.ApplyAtCenterOfMass = true
NewLineForce.Attachment0 = NewAttachment
NewLineForce.Attachment1 = NewAttachment2
NewLineForce.Magnitude = Force.Magnitude * 2
NewLineForce.Parent = NewProjectile

local NewVectorForce = Instance.new("VectorForce")
NewVectorForce.Enabled = true
NewVectorForce.Attachment0 = NewAttachment
NewVectorForce.Parent = NewProjectile

NewVectorForce.Force = Force

coroutine.wrap(function()
    wait(2)
    print("LineForceEnabled")
    print(NewLineForce.Active)
    NewLineForce.Enabled = true
    print(NewLineForce.Active)
end)()

local ObjectValue = Instance.new("ObjectValue")
ObjectValue.Parent = NewProjectile

local Connec
Connec = NewProjectile.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        --if hit.Parent ~= char then
            print("hit the char known as " .. tostring(hit.Parent))
            ObjectValue.Value = hit.Parent
        --end
    end
end)

coroutine.wrap(function()
    wait(10)
    Connec:Disconnect()
    NewProjectile:Destroy()
    return nil
end)()

ObjectValue.Changed:Wait()
NewProjectile:Destroy()
return ObjectValue.Value

However when I want to move this over to my actual game it stops working, (The testing area has 0 gravity which is why force is different), this is the script for my actual game:

function SodaCombat.CreateCombatFizz(plr,EnemyChar)
	local char = plr.Character
	
	local NewAttachment2 = EnemyChar.PrimaryPart.TargetAttachment

	print(EnemyChar)
	local NewAttachment2 = EnemyChar.PrimaryPart.TargetAttachment
	local NewProjectile = FizzProjectile:Clone()
	NewProjectile.Parent = workspace--.Projectiles
	NewProjectile:SetNetworkOwner(nil)
	NewProjectile.Position = char.PrimaryPart.Position + Vector3.new(0,5,0)
	
	local NewAttachment = Instance.new("Attachment")
	NewAttachment.Parent = NewProjectile

	local Scale = 1
	
	local Force = Vector3.new(2*Scale,(workspace.Gravity * NewProjectile.Mass)+ 1*Scale,math.random(-2,2)*Scale) 
	
	local NewLineForce = Instance.new("LineForce")
	NewLineForce.Enabled = false
	NewLineForce.ApplyAtCenterOfMass = false
	NewLineForce.Attachment0 = NewAttachment
	NewLineForce.Attachment1 = NewAttachment2
	NewLineForce.Magnitude = Force.Magnitude * 2
	NewLineForce.Parent = NewProjectile
			
	local NewVectorForce = Instance.new("VectorForce")
	NewVectorForce.Enabled = true
	NewVectorForce.Attachment0 = NewAttachment
	NewVectorForce.Parent = NewProjectile

	NewVectorForce.Force = Force
	
	coroutine.wrap(function()
		wait(2)
		NewLineForce.Attachment1 = NewAttachment2
		NewLineForce.Enabled = true
		wait()
		print(NewLineForce.Attachment1)
		print(NewLineForce.Active)
	end)()
	
	local ObjectValue = Instance.new("ObjectValue")
	ObjectValue.Parent = NewProjectile
	
	local Connec
	Connec = NewProjectile.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			if hit.Parent ~= char then
				print("hit the char known as " .. tostring(hit.Parent))
				ObjectValue.Value = hit.Parent
			end
		end
	end)
	
	coroutine.wrap(function()
		wait(10)
		Connec:Disconnect()
		NewProjectile:Destroy()
		return nil
	end)()
	
	ObjectValue.Changed:Wait()
	NewProjectile:Destroy()
	return ObjectValue.Value
end

The above script works sometimes (always at the start before I give time for the game to fully load) where it also prints that .Active is true, however after that it just stops working completely with only the VectorForce working, the LineForce’s .Active property prints false from then on.

If anything was unclear please reply and ask me I’ve been stuck on this for a day and it’s really frustrating.

1 Like