Why does the ball dont move?

Im making my game BUT the bodyVelocity dosent move the ball.
Here is the code

		if player.GloveValues.SoulSnatcher.Value then
			local SoulSnatcher = game.ServerStorage:WaitForChild("SoulServStorage"):WaitForChild("SoulSnatcher")
			local char = player.Character
			local newSoulSnatcher = SoulSnatcher:Clone()
			local targetPosition = char.HumanoidRootPart.Position + Vector3.new(0, 5, 0)
			newSoulSnatcher.Position = targetPosition
			
			local bodyVelocity = Instance.new("BodyVelocity")
			bodyVelocity.MaxForce = Vector3.new(5000, 5000, 5000)
			
			local direction = (cframe.p - newSoulSnatcher.Position).Unit
			bodyVelocity.Velocity = direction * 500  
			bodyVelocity.Parent = newSoulSnatcher
			newSoulSnatcher.Parent = workspace
			
			local bodyPosition = Instance.new("BodyPosition", newSoulSnatcher)
			bodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
			bodyPosition.D = 10
			bodyPosition.Position = targetPosition
			

			local touchConn
			touchConn = newSoulSnatcher.Touched:Connect(function(hit)
				if hit.Parent:FindFirstChild("Humanoid") then
					if hit.Parent.Name ~= player.Name then
						char.Humanoid.Sit = true
						local force = Instance.new("BodyVelocity", char)
						force.MaxForce = Vector3.new(2, 2, 2) * math.huge
						force.Velocity = direction * 20 

						local rotation = Instance.new("BodyAngularVelocity", newSoulSnatcher)
						rotation.AngularVelocity = Vector3.new(1, 1, 1) * math.pi * math.random(1, 5)
						rotation.MaxTorque = Vector3.new(2, 2, 2) * math.huge
						rotation.P = 5000
						game:GetService("Debris"):AddItem(force, 0.35)
						game:GetService("Debris"):AddItem(rotation, 0.35)

						local Ragdoll = require(game:GetService("ReplicatedStorage"):WaitForChild("RagdollCharacterV1"))
						local RiggedChar
						local Ragdolled = false
						if not RiggedChar then
							RiggedChar = Ragdoll:SetupRagdoll(char, true)
						end
						if not Ragdolled then
							RiggedChar.Ragdoll(4)
							wait(4)
							RiggedChar.Unragdoll()
						end
						char.Humanoid.Sit = false
					end
				end
			end)
			wait(5)
			if touchConn ~= nil then touchConn:Disconnect() end
			newSoulSnatcher:Destroy()
		end

If u can help ty!!
If someone is asking CFrame is the mouse.Hit
(This is made by remoteevent)

2 Likes

Is the Soul Snatcher glove a model?

Correct me if I’m wrong, but doesn’t a BodyVelocity not work when parented to a model?

You would want to parent it to something like the primary part of the glove.

the soul snatcherr is a part not a model

I think there is something wrong with the BodyVelocity
I put Massless on and I will see if smth happens

  1. BodyVelocities, BodtAngularVelocities and BodyPositions are deprecated (but should work so don’t worry). Just in case, you can try using LineForce and AngularVelocity, those aren’t deprecated.
  2. Mouse.hit got replaced with UserInputService:GetMouseLocation() and workspace:Raycast(). but I’m sure Mouse.hit still works so also don’t worry. (basically roblox wants you to manually raycast)
  3. You can add more MaxForce to the BodyVelocity (way more) if it doesn’t work (it should with 5k idk why it doesnt work) or maybe it’s because you didnt change ‘Velocity’ property. < I’m sure this is the solution

I changed the velocity property right here:

			local bodyVelocity = Instance.new("BodyVelocity")
			bodyVelocity.MaxForce = Vector3.new(5000, 5000, 5000)
			local direction = (cframe.p - newSoulSnatcher.Position).Unit
			bodyVelocity.Velocity = direction * 500  
			bodyVelocity.Parent = newSoulSnatcher
			newSoulSnatcher.Parent = workspace

I also changed the maxforce.
i also used Lineforce and same.

I did it like this with the lineforce

local bodyVelocity = Instance.new("LineForce")
			bodyVelocity.MaxForce = 15000
			local direction = (cframe.p - newSoulSnatcher.Position).Unit
			bodyVelocity.Magnitude = tonumber(direction * 500) 
			bodyVelocity.Parent = newSoulSnatcher
			newSoulSnatcher.Parent = workspace

does it work?

No it dosent work It does same as the BodyVelocity

And for aclaration here is the full script

local Ragdoll = require(game:GetService("ReplicatedStorage").RagdollCharacterV1)
local event = game:GetService("ReplicatedStorage"):WaitForChild("AbiliyEvent")

event.OnServerEvent:Connect(function(player:Player, equipped,cframe)
	local char = player.Character
	local Hum = char:FindFirstChildOfClass("Humanoid")
	
	if equipped.Value == 1 then
		local Fart = game.ServerStorage:WaitForChild("Fart")
		local ClonedFart = Fart:Clone()
		ClonedFart.Parent = char.HumanoidRootPart
		ClonedFart:Play()
		Hum.WalkSpeed = 32
		wait(2.5)
		ClonedFart:Destroy()
		Hum.WalkSpeed = 16
	elseif equipped.Value == 3 then
		if player.GloveValues.SoulSnatcher.Value then
			local SoulSnatcher = game.ServerStorage:WaitForChild("SoulServStorage"):WaitForChild("SoulSnatcher")
			local char = player.Character
			local newSoulSnatcher = SoulSnatcher:Clone()

			
			local targetPosition = char.HumanoidRootPart.Position + Vector3.new(0, 5, 0)
			newSoulSnatcher.Position = targetPosition

			local bodyVelocity = Instance.new("LineForce")
			bodyVelocity.MaxForce = 15000
			local direction = (cframe.p - newSoulSnatcher.Position).Unit
			bodyVelocity.Magnitude = tonumber(direction * 500) 
			bodyVelocity.Parent = newSoulSnatcher
			newSoulSnatcher.Parent = workspace
			
			local bodyPosition = Instance.new("BodyPosition", newSoulSnatcher)
			bodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
			bodyPosition.D = 10
			bodyPosition.Position = targetPosition

			local touchConn
			touchConn = newSoulSnatcher.Touched:Connect(function(hit)
				if hit.Parent:FindFirstChild("Humanoid") then
					if hit.Parent.Name ~= player.Name then
						char.Humanoid.Sit = true

						local force = Instance.new("BodyVelocity", char)
						force.MaxForce = Vector3.new(2, 2, 2) * math.huge
						force.Velocity = direction * 20 -- Push the player away from the SoulSnatcher

						local rotation = Instance.new("BodyAngularVelocity", newSoulSnatcher)
						rotation.AngularVelocity = Vector3.new(1, 1, 1) * math.pi * math.random(1, 5)
						rotation.MaxTorque = Vector3.new(2, 2, 2) * math.huge
						rotation.P = 5000

						game:GetService("Debris"):AddItem(force, 0.35)
						game:GetService("Debris"):AddItem(rotation, 0.35)

						local Ragdoll = require(game:GetService("ReplicatedStorage"):WaitForChild("RagdollCharacterV1"))
						local RiggedChar
						local Ragdolled = false
						if not RiggedChar then
							RiggedChar = Ragdoll:SetupRagdoll(char, true)
						end
						if not Ragdolled then
							RiggedChar.Ragdoll(4)
							wait(4)
							RiggedChar.Unragdoll()
						end
						char.Humanoid.Sit = false
					end
				end
			end)
			wait(5)
			if touchConn ~= nil then touchConn:Disconnect() end
			newSoulSnatcher:Destroy()
		end
	end
end)

I forgot to say it, but the point 1 and 2 is just in case roblox stops supporting those classes, you shouldn’t worry about them now, and I don’t have any idea of what the problem may be.
Also, I think VectorForce is better for replicating BodyVelocity and LineForce for replicating BodyPosition… (Didn’t think about that.) Also, VectorForce needs an attachment (and lineforce two bc it moves an attachment to another). You can’t even use tonumber on Vector3, so maybe that’s also another error.

When i tried using vector it said unable to convert to a number as a warning

Don’t do tonumber(direction * 500). That code tries to convert a Vector3 into a number and fails. That’s why I suggested using VectorForce and setting ‘RelativeTo’ to World. (it’s an enum)

I did this:

local bodyVelocity = Instance.new("VectorForce")
			local direction = (cframe.p - newSoulSnatcher.Position).Unit
			bodyVelocity.Force =  direction * 1000
			bodyVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
			bodyVelocity.Parent = newSoulSnatcher
			newSoulSnatcher.Parent = workspace

Works?
oh wait you forgot to set an attachment to the VectorForce.

OOOOOOH okay so i like instance.new the attachement???

yeah, and then you set .Attachment0 to the attachment you made inside newSoulSnatcher.

I did this:

local bodyVelocity = Instance.new("VectorForce")
			local direction = (cframe.p - newSoulSnatcher.Position).Unit
			bodyVelocity.Force =  direction * 1000
			bodyVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
			bodyVelocity.Parent = newSoulSnatcher
			newSoulSnatcher.Parent = workspace
			local Attachement = Instance.new("Attachment")
			Attachement.Position = direction + Vector3.new(200,0,0)
			bodyVelocity.Attachment0 = Attachement

You don’t need to set .Position to direction+Vector3.new(200,0,0) (you can set it to Vector3.zero, just change .RelativeTo because the direction is relative to the world.

I found the solution,
What happened is the BodyPosition was moving back the VectorForce

bodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

That line of code was making so it didnt move,
because BodyPositions makes the object static,
so what i did to fix it is change the MaxForce
to:

bodyPosition.MaxForce = Vector3.new(0, math.huge, math.huge)

so that makes its not gonna affect on the X axis but it is still floating 5 studs as I wanted. Thanks to everyone who helped!