Hello everyone.
I’m making a game like Five Nights at Freddy’s in Roblox. Everything is done except the main menu and GUI. The problem is that the enemy AI isn’t turning on and off. I tried disabling the script and using values but nothing worked. And the EnemyAI scripts are loops if that helps.
This is how the game would work:
- Joining the game
- Clicking a start button
- Cutscene plays
- AI turning on (PROBLEM)
- When you die the game takes you to the main menu
- AI turning off (PROBLEM)
- Everything resets
- Clicking a start button (Playing again)
This is the script for one of the enemies:
while workspace.Values.Start.Value == true do -- I don't know what to do here
if script.Parent.Position.Z == -25 then
workspace.Values.ClockJumpscare.Value = true -- Death
else
-- Enemy Movement
script.Parent.Parent.Parent.NeonPart.Transparency = 1
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0.8
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0.8
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0.4
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0.2
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0
wait(0.1)
script.Parent.Position += Vector3.new(0, 0, -2.5)
wait(0.375)
script.Parent.Parent.Parent.NeonPart.Transparency = 0.2
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0.4
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0.6
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 0.8
wait()
script.Parent.Parent.Parent.NeonPart.Transparency = 1
end
end
Thanks for reading.