(HELP) How to script Hostile/Friendly monsters

Hello!

I have a question.

So if you played SCP 3008 (IKEA) on roblox, you could see that monsters are friendly when it’s day time, and hostile on night time…
How can I make something like that, I need that for my game.

Well of course firstly you need to script the basic components to make an AI enemy

Afterwards, you could make a BoolValue that determines when the enemies can attack via checking its value and if’s true or false and preventing the Chasing AI from working if it’s one of those two. This of course has to be serversided, which shouldn’t be an issue as AI scripts are always server sided for the most part. For the stuff like day/night, you could use Lighting’s TimeOfDay property which requires a formatted time, “01:30:00” for example, and sets that as the sun/moon position ingame. Or you could use ClockTime, which takes i nthe input you give it as hours, or the function SetMinutesAfterMidnight, all of these work to change the time

Hopefully what I said should make sense for something like how you want, if you require any more assistance with the theory behind making something that, I’ll be happy to help!

2 Likes

Hi, @SinisterPlayz, should be easy! First, the night & day set-up is easy! Either you use:

  • ClockTime
  • SetMinutesAfterMidnight

Like @EmbatTheHybrid said, you should use a bool value, so with the above, if it is true, you make it attacking, if it is false, you make it a good person. More information about bool values:*

3 Likes