Hi!
How do I make it so that an NPC can request things? Like something similar to Hotel Mania or Restaurant Tycoon 2.
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
/SurfaceGui
s for their request GUI, RemoteFunction
s for getting their requests, and probably RemoteEvent
s 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 RemoteEvent
s and RemoteFunction
s, 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.
Hi
Would you be interested in being the scripter of my game? It’s a paid comission of course
I could be, but that should be discussed on the Talent Hub.
Hi,
I sent you an invitation on Talent Hub