Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't Humanoid:MoveTo() work locally?

Asked by 2 years ago

Hi, I'm making a game where NPC bots spawn locally on the client.

I clone in the prebuilt bot on the client then add in the "Animate" and "Chase" localscripts. I am getting no errors but the bot refuses to move or even idle animate. I have tried adding the scripts as server scripts too, with no luck.

Also, I can confirm that no parts of the bot are Anchored.

Here's the local scripts:

Spawn:

--SPAWN FUNCTION
local function MONSTER(zone, spawnloc)
    if tostring(zone) == "3" then
        if not workspace.Monsters:FindFirstChild("EvilBob") then
            local lighting = game.Lighting
            lighting.FogEnd = 25
            lighting.FogStart = 5
            for i,v in pairs(zone.Events.Bob:GetDescendants()) do
                if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" or v:IsA("Decal") then
                    v.Transparency = 1
                end
            end
            zone.Events.Handle.Transparency = 1
            --clone
            local bob = zone.Events.EvilBob:Clone()
            bob:SetPrimaryPartCFrame(spawnloc)
            bob.Parent = workspace.Monsters
            local animate = script.Animate:Clone()
            animate.Parent = bob
            animate.Disabled = false
            local Chase = script.Chase:Clone()
            --Chase.Target.Value = game.Players.LocalPlayer.Character
            Chase.Parent = bob
            Chase.Disabled = false
        end
    end
end

game.ReplicatedStorage.SpawnMonster.OnClientEvent:Connect(MONSTER)

Chase:

--CHASE
while true do
    wait()
    local target = game.Players.LocalPlayer.Character
    if target ~= nil then
        script.Parent:FindFirstChildOfClass("Humanoid"):MoveTo(target.Position, target)
    end

end

And then I also have the default R15 animation script from roblox

Any ideas on how to get this bot to move locally?

Thanks,

Answer this question