Tween going to (0,0,0) every time

I forgot to set the .Parent property.

local ThisPart = script.Parent
ThisPart.Anchored = false
local Force = Instance.new("BodyPosition")
Force.Position = ThisPart.Position
Force.MaxForce = Vector3.new(3000,5000,3000)
Force.D = 1000
Force.Parent = ThisPart
local players = game:GetService("Players"):GetPlayers()
local pickedPlayer = players[math.random(1, #players)]

local alredytriggered = false

while wait() do
	local PlrPosition = pickedPlayer.Character:FindFirstChild("HumanoidRootPart").Position

	Distance = (ThisPart.Position - PlrPosition).Magnitude

	if Distance < 20 or alredytriggered == true then
		alredytriggered = true
	Force.Position = PlrPosition
	end
end

Try it now

3 things:

  1. When the orb is placed the orb teleports to a specific location again

  2. The orb is WAY smoother than before so :+1:

  3. The orb still does the chasing thing


local ThisPart = script.Parent
local can = true

local players = game:GetService("Players"):GetPlayers()
local pickedPlayer = players[math.random(1, #players)]

while wait() do
	local PlrPosition = pickedPlayer.Character.PrimaryPart.Position

	Distance = (ThisPart.Position - PlrPosition).Magnitude
	if Distance < 10 and can == true then

		can = false

		local TweenService = game:GetService("TweenService")

		local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0,false,0)

		local tween = TweenService:Create(ThisPart, tweenInfo, {Position = Vector3.new(PlrPosition.X, PlrPosition.Y, PlrPosition.Z)})

		tween:Play()
	end
end

But we don’t need that code anymore

I only changed the position so he can grab that chunk out. I should highlight it rq.

ThisPart.Anchored = true
wait(1)
local ThisPart = script.Parent
ThisPart.Anchored = false
local Force = Instance.new("BodyPosition")
Force.Position = ThisPart.Position
Force.MaxForce = Vector3.new(3000,5000,3000)
Force.D = 1000
Force.Parent = ThisPart
local players = game:GetService("Players"):GetPlayers()
local pickedPlayer = players[math.random(1, #players)]

local alredytriggered = false

while wait() do
	local PlrPosition = pickedPlayer.Character:FindFirstChild("HumanoidRootPart").Position

	Distance = (ThisPart.Position - PlrPosition).Magnitude

	if Distance < 20 or alredytriggered == true then
		alredytriggered = true
	Force.Position = PlrPosition
	end
end
{Position = Vector3.new(PlrPosition.X, PlrPosition.Y, PlrPosition.Z)})

Replace this for position. PlrPosition is a Vector3 and you can’t place a Vector3 within one part and leaving the rest blank.

That is just PlrPosition but unnecessary complicated so anyone who wants to edit the code has a stroke.

This should make sure its position is where it is created

GOOD NEWS!!!

  1. The orb reacts when near it while also staying in place

  2. The orb still can’t catch up with the player

Would you like a vid?

local Time = 1
local Orb = nil --Path orb
while task.wait() do
Orb.CFrame = Orb.CFrame:Lerp(PlrPosition, Time)
end

Try lerping.
Not too familiar with it so do some trial/error runs.

ThisPart.Anchored = true
wait(1)
local ThisPart = script.Parent
ThisPart.Anchored = false
local Force = Instance.new("BodyPosition")
Force.Position = ThisPart.Position
Force.MaxForce = Vector3.new(3000,5000,3000)
Force.D = 1000
Force.Parent = ThisPart
Force.P = 20 --Change this to whatever the speed is?
local players = game:GetService("Players"):GetPlayers()
local pickedPlayer = players[math.random(1, #players)]

local alredytriggered = false

while wait() do
	local PlrPosition = pickedPlayer.Character:FindFirstChild("HumanoidRootPart").Position

	Distance = (ThisPart.Position - PlrPosition).Magnitude

	if Distance < 20 or alredytriggered == true then
		alredytriggered = true
	Force.Position = PlrPosition
	end
end

Referring back to this code, you could increase the force of the orb to make it go faster.
Never used BodyPosition before so whichever controls the speed.

Also yeah, a video would be cool if that’s necessary.

So increasing the force did not do anything but here is the video

(post deleted by author)

not really

I did and nothing happened… Am I doing it wrong?

I said Vector3.new(5000,7000,5000)

I know how to fix it. Decrease Force.D
Force.D = 300
The reason it can’t catch up because it is decelerating (That’s what D does)

1 Like

PERFECT!!! I thank everyone for all the help I got!

And to think, you were using TweenService! the code has been changed so much and I’m glad that BodyPosition worked good for you! It’s amazing that BodyPosition is Deprecated.

Indeed, again thank you very much!

Did you know that BodyPosition was deprecated? it introduced me to scripting.

Also, could you send a video?