Tornado :MoveTo() script not performing properly

Hey there!

I’m attempting to make a working Tornado system, but instead of going from point to point, my tornado just goes to one point, then stops when using Humanoid:MoveTo()?

Script [Inside of Tornado Model]:

local minX = -253.99
local maxX = 253.99
local minZ = -254.97
local maxZ = 254.97
while true do
	wait(.5)
	for i, v in pairs(game.Workspace.PossibleFunnelParts:GetChildren()) do
		script.Parent.Humanoid:MoveTo(game.Workspace.PossibleFunnelParts:GetChildren()[i].Position)
	end
end

Any and all help is appreciated. Thanks! (I’m going to bed, I will read all replies when I get up. Sorry! :slight_smile: )

1 Like

Is there something like:

local minX = -253.99
local maxX = 253.99
local minZ = -254.97
local maxZ = 254.97
while true do
	wait(.5)
	for i, v in pairs(game.Workspace.PossibleFunnelParts:GetChildren()) do
		script.Parent.Humanoid:MoveTo(game.Workspace.PossibleFunnelParts:GetChildren()[i].Position)
-- Wait until thing has moved to the position.
	end
end

I am using a Humanoid Rig, it has a humanoid and a humanoidrootpart.

So I would use this, right?

script.Parent:MoveToFininished():Wait()

I’d set the HumanoidRootPart CFrame to the Funnel part.
script.Parent.HumanoidRootPart.CFrame = game.Workspace.PossibleFunnelParts:GetChildren()[i].CFrame

I want it to be animated, not teleported.

Ah now I see, here I’ll write TweenService:

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --change 5 to time you want
local minX = -253.99
local maxX = 253.99
local minZ = -254.97
local maxZ = 254.97
while true do
	wait(.5)
	for i, v in pairs(game.Workspace.PossibleFunnelParts:GetChildren()) do
		local tween = ts:Create(script.Parent.HumanoidRootPart,ti, {CFrame = game.Workspace.PossibleFunnelParts:GetChildren()[i].CFrame})
        tween:Play()
	end
end

Hope I got it all right!
Don’t hesitate to ask how it works/how to change it I’ll run through it if needed.

Hey there. So, I did this, and it just goes to one point, then stops?

Hmm maybe after the tween:Play() do

tween.Completed:Wait()

Here’s my new script:

local minX = -253.99
local maxX = 253.99
local minZ = -254.97
local maxZ = 254.97
local X = math.random(minX, maxX)
local Z = math.random(minZ, maxZ)
local Y = 82.793
while true do
	wait(.3)
	script.Parent.Humanoid:MoveTo(Vector3.new(X,Y,Z))
	script.Parent.Humanoid.MoveToFinished:Wait()
end

What it does is:

The funnel cloud moves to a location, then stops.

Thanks! :smiley:

Then you would have to loop the part that changes the position:

local minX = -253.99
local maxX = 253.99
local minZ = -254.97
local maxZ = 254.97
while true do
    local X = math.random(minX, maxX)
    local Z = math.random(minZ, maxZ)
    local Y = 82.793
    wait(.3)
	script.Parent.Humanoid:MoveTo(Vector3.new(X,Y,Z))
	script.Parent.Humanoid.MoveToFinished:Wait()
end

You never update X Y and Z again, so they remain the same.

1 Like

That’s correct. Then it should work.

Didn’t work. :thinking: :smiley: