NPC Employees - How Do You Make NPC Employees? (Upgradable (Making Them Faster At Their Job), Cleaning, Restocking, etc)

Hello,

I need some major assistance with making NPC employees do tasks like cleaning, restocking, etc. These can be upgradable, increasing the speed and capacity they work at.

I am mainly looking for a script(s) that can execute these tasks as mentioned above and also how I would link things to a GUI Which would have the purchase NPC and upgrade panel.

Any help is appreciate,

Thanks,
Seb.

6 Likes

you can’t ask for scripts, this category is for assisting with problems with your scripts. to add upgradables to the npc, simply use your common sense and for faster walkspeed, change the humanoid’s walkspeed and for restocking and cleaning, change the value that determines the speed respectively

you can make it fire a remote function in the client which contains the necessary parameters

pseudocode in the server:

EmployeeUpgradeRequest.OnServerInvoke = function(sender: Player, npc: Model, task: string)

-- some function that checks if the employee is the player's employee to avoid exploiters trying to sabotage others
local IsValidOwnership = GetEmployeeOwnership(npc) == sender

if not IsValidOwnership then return false, "Invalid ownership" end

local CurrentTaskLevel = GetEmployeeTaskLevel(npc, task)

SetEmployeeTaskLevel(npc, CurrentTaskLevel + 1)

return true, `{npc.Name} is now {CurrentTaskLevel+1}`

end
6 Likes

I suggest listen what @Artzified said, I learned many stuff from them.

I could say, module of actions (as cleaning etc, with time speed values), module that controls PathFinding and walkSpeed, targets etc.

The more you want a system to fit your needs then the most you are going away from any “generic” scripts you fount out there.

If you dont know how to script, then this is a very interesting and complex project to start with!

6 Likes

Thank you very much for your response I do Appreciate it.

I will take on board what you have said here and thank you for the advice on the Pathfinding and walkspeeds, targets etc.

2 Likes

Thank you very much for your response I do appreciate it a lot.

In terms of your first point, I wasn’t asking for a script, I know it does sound like that but it’s just the way I phrased it. What I meant was, what language of roblox lua should I use to get started on making a script like this?

For the second point, thank you very much for the advice on the remote functions, I will take that into account and the script you replied with.

Thanks again,
Seb.

2 Likes

umm? can you clarify by “what language of roblox lua should i use”? roblox uses a embeddable scripting language derived from lua called Luau

2 Likes

By this, I meant which part of the language should I use to script this (Functions, Loops, etc)

Hope this helps clarify what I meant.

Seb.

2 Likes

thats really a vague question, those are the foundational concepts of basically every programming language, you can use those approaches (maybe more) for the task. you need to script the client-side to handle user-inputs such as listening to button clicks and getting the necessary input data to send to the server using the remote function. and the server to validate and do the requests from the client

3 Likes

Hello once more,

Thanks very much for all your responses so far and your patience.

I already knew that starting this project would be extremely difficult as I don’t have a massive amount of knowledge with luau (Basic knowledge).

Do you have any suggestions on where I can learn luau so that I can wrap this concept around my head a bit more?

I really do appreciate your support with this and know that what I am asking of is, well, too much since like you stated earlier, this is just for support, not entire scripts.

P.S. I’ve tried many yt videos but they only give me short-term knowledge on some topics or rarely help with what I actually require to learn.

4 Likes

you could do some small projects from time to time (e.g Pathfinding AI, networking, etc) and even now im still learning new stuff, i don’t really know other advices i could give but:

try to modify the project you made/learnt with the videos, like implementing other mechanics into the project and changing the values to further understand the concepts

also try to make something without any major help (maybe allow yourself with some devforum and stackoverflow but try to not watch tutorials)

3 Likes

You are an absolute star, thanks for this.

Il mark this as the solution as it helped me a lot.

If you have any more questions/advice please do reply to this comment as I will take all advice that I can get.

Thanks again,

Seb.

3 Likes

Not to break the mood here but it’s advised not to start a big project with little experience with programming. It’ll basically be a huge burden for yourself to the point you want to call it quits. On top of that, like from what @Artzified said, do small projects to slowly improve and get better. Programming requires patience and logical thinking—you can’t just think of a script like “Hey, I want this piece of code to do this and that!”, they would require extensive debugging, customizability and flexibility.

Forum-wise, don’t expect everyone to freely give out free answers (spoon-feeding), especially on #help-and-feedback. You have to learn them all by yourself (but with other resources of course) because everyone has their own styles and preferences on coding and that not all code works for everyone and not everyone would benefit from such code—it varies from projects to projects!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.