SOLVED: I changed the position argument of MoveTo to a constant y value, for some reason that worked.

Hello, I was editing with the humanoid and wanted to make it continually walk without any user input. I kind of accomplished it, however, I have this weird problem where after walking a little while this green bar starts to appear and gets progressively closer(or bigger?) as time goes on until the point where it stops.

Example : Pic

If you want to see it for yourself: Place

I believe it has something to do with MoveTo, but I'm really not sure what's causing it.

This is in a local script.

I have a snippet of code here that I suspect to be the cause:

repeat wait() until game.Players.LocalPlayer.Character
wait(.2)

local plr = game.Players.LocalPlayer
local chr = plr.Character
local cam = Workspace.CurrentCamera
local tor = chr.Torso
local hum = chr.Humanoid
local TorZ = tor.Position.Z

cam.CameraType = 'Scriptable'



game:GetService('RunService').RenderStepped:connect(function()
    local x,y,z = tor.Position.X - 10 ,tor.Position.Y ,tor.Position.Z + 5 -- Offsets in position, makes the camera in back of character and to the side a little
    cam.CoordinateFrame = CFrame.new(Vector3.new(x,y,z),Vector3.new(math.abs((x+20)*5),y,z)) -- Make camera have the offset pos, and have it look towards a point ahead of the character
    hum:MoveTo(Vector3.new(math.abs(x) + 20,y,TorZ),Workspace.Part2) -- Continually have the character walk forward
end)

I'd greatly appreciate any ideas on why this is happening, thank you.

2 comments

0

the code above is not the problem i tested anyways it just seems you have a billboard gui or a reg gui in the way

1

It does appear to be that, but there is no gui object of any sort visible in the explorer. In addition, I never instanced a gui object or manually put one in the startergui. :/