Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make some ghost walk across a map?

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

✓ Accepted answer

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 =)

5 comments

0

Actually I'm here to learn from you guys becuase I'm very nooby at scripting.

1

Ah, that's great! We're (some of us) are glad to help!

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).

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.

1

Golden, I know, but that could jumpscare even when you join!!

This discussion is preserved as it was. New answers, comments, and votes are closed.