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

How to make some ghost walk across a map?

Asked by 8 years ago

I'm just wondering how can we make an "AI" go across a map, like a ghost.

When he sees you, he gets closer and closer.

Thanks for answering! :D

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

Wow, man, you're a very curious person! I'm answering all your questions, so feel free to ask more, xD! Answered 2 already, xD! Here's how it works: We obtain the AI, we get the humanoid, we make the point where we want it to go, and we make it go there using MoveTo(position)

Step 1: Get the Point,AKA the place where the character walks to. Create a part in Workspace, name the part "Point" move the part wherever you want the AI to go.

Now let's get to work!


-- Regular script function AiMove() local Point = workspace.Point.Position local AI = workspace:FindFirstChild("Artificial intelligence") --[[ Put the name of the AI here, or name it to Artificial intelligence, either one works. --]] local human = AI.Humanoid human:MoveTo(Point) end

Now, this makes the AI move using a function, HOWEVER, we got to make the function activate now. Let's do this when the player joins, to make sure the ghost doesn't start moving when they're loading.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(chara)
        AiMove()
    end)
end)

Now, the AI will move when the character has been added.

Hope I helped, remember to ask for more help if you need it, tell me if it worked, or accept my answer! Good day =)

0
Actually I'm here to learn from you guys becuase I'm very nooby at scripting. TheCoolRobloxian4 20 — 8y
1
Ah, that's great! We're (some of us) are glad to help! DaCrazyDev 444 — 8y
0
If you don't need to pass any arguments to the function that the event doesnt pass, you can just do CharacterAdded:Connect(AiMove). GoldenPhysics 474 — 8y
0
I do suggest answering these types of questions with links of needed information so the player can learn how to make this, otherwise it's almost as if answering a 'make me this' question if you do it all. alphawolvess 1784 — 8y
1
Golden, I know, but that could jumpscare even when you join!! DaCrazyDev 444 — 8y
Ad

Answer this question