Model not staying in the air

Hey devs,
I am currently making a simple system to make a model move in random places, it works fine. The only problem is that I set the height to 10 studs, but the model still stays on the ground… I tried playing around with the anchor settings but it didn’t change anything. What can I do to fix it ?

local Dummy = script.Parent
local Humanoid = Dummy:WaitForChild("Humanoid")
while true do
	Humanoid:MoveTo(Vector3.new(math.random(-50,50),10,math.random(-50,50)))
	repeat wait() until Humanoid.MoveToFinished
	wait(math.random(1, 10))
end

Any help is appreciated,thanks.

2 Likes

Humanoid.MoveTo commands walking, and you can’t hover-walk. He will walk to the X and Z coordinates but remain on the ground. If you tell me exactly how you want it to behave (i.e. leaping, floating, frozen in place, launching towards the position, etc etc) then I will give some suggestions on how to do what you want.

1 Like

I just want to make it fly to a random location. Thats it.

Best you can do is try and do TweenService with the dummy. I ain’t sure if this will even work I never tried but maybe you can try it?

What Part do I Tween?
The part you need to tween is “HumanoidRootPart”

You can make it fly to locations by doing it this way.

How do I make it stay in the air when the dummy arrives at the location?
You can simply enough do:

-- // Make it stay where it is
HumanoidRootPart.Anchored = true
-- // Make it go down
HumanoidRootPart.Anchored = false

Here is how to use TweenService:
TweenService (roblox.com)

2 Likes

Just tried out this script :

local TweenService = game:GetService("TweenService")
while true do
	local goal = {}
	goal.Position = Vector3.new(math.random(-50,50),10,math.random(-50,50))
	local timeG = math.random(3, 10)
	local info = TweenInfo.new(timeG)


	local Tween = TweenService:Create(script.Parent.HumanoidRootPart, info, goal)

	Tween:Play()
	wait(timeG+math.random(1, 10))
end

and for some reason, its deleting the HumanoidRootPart which is really strange (also this isn’t exactly a roblox character, its a butterfly with a humanoid and HumanoidRootPart)

Can yous show whats in the model?

image

is any of them welded?
weld butterfly wing left / right to HumanoidRootPart then try

Part0 = HumanoidRootPart
Part1 = Wing left / Right

1 Like

image
wait forgot to show these, they are jointed to the HumanoidRootPart with Motor6D, also now for some reason even without the script its deleting everything in the model appart for the Humanoid, help pls

try and weld normally then try.

I managed to make it stop deleting itself by anchoring it… (strange fix but ig)

So does it work fine now the way you wanted it to?

Yes thanks you ! This extra sentence just exist to go past the minimum

1 Like

Humanoid:MoveTo only works for 7 seconds so you would have to loop it

local Dummy = script.Parent
local Humanoid = Dummy:WaitForChild("Humanoid")
local HMR = Dummy:WaitForChild("HumanoidRootPart")
while true do
	Humanoid:MoveTo(Vector3.new(math.random(-50,50),10,math.random(-50,50)))
	local Position = HMR.Position
	repeat 
		task.wait()
		HMR.CFrame = CFrame.new(Position.X, 50, Position.Z)
	until Humanoid.MoveToFinished
	wait(math.random(1, 10))
end
1 Like