How to make an NPC that does things like (cook and request things)

Hi!

How do I make it so that an NPC can request things? Like something similar to Hotel Mania or Restaurant Tycoon 2.

You shouldn’t directly ask a question like that, you should first try to make it yourself, and post it here if it doesn’t work. But in general, You need BillboardGui/SurfaceGuis for their request GUI, RemoteFunctions for getting their requests, and probably RemoteEvents too.

I’m fairly new to scripting. Is there any tutorial I could follow for that?

This seems like a quite bland question, but I’ll try my best. First off you should create a module script for everything you want for example make eggs or bacon, etc. It should look something like this.

local Recipes = {}

Recipes.Eggs = function()

end

Recipes.Bacon = funciton()

end

return Recipes

Then create a gui with the thing you want to order. Then using Remote Events like @cnr123451 said fire it to a server script and if it’s in the module then do stuff.

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local Recipes = require(game:GetService("ServerStorage"):WaitForChild("Recipes"))

RemoteEvent.OnServerEvent:Connect(player, recipe)
   if Recipes[recipe] then
       Recipes[recipe]() -- Fires module
   end
end)

Yes, I remember seeing many tutorials in #resources:community-tutorials, but I’ll be linking to official tutorials which are still simple to understand.

For RemoteEvents and RemoteFunctions, I would recommend you to read this and this. Billboard and Surface Guis are simple, and I’m sure you can find a good tutorial for that. You will also need to know how to move an NPC which is also simple: You just get the NPC, find the Humanoid in it, and call MoveTo (for example, npc.Humanoid:MoveTo(--[[enter position here]])). Here is a tutorial for that.

1 Like

Hi

Would you be interested in being the scripter of my game? It’s a paid comission of course :slight_smile:

I could be, but that should be discussed on the Talent Hub.

1 Like

Hi,
I sent you an invitation on Talent Hub :slight_smile: