Monster jumpscare help

i have a monster ai and its big and tall and i made a jumpscare where if u touch it it will play the jumpscrare but the script i use to make it an ai makes it where if u get near it and not touch it u will die so i cant play the jumpscrare cuz i aint touching it any help here is the script for the ai

i will send a vid through my phone brb

2 Likes

line 67 is the thing that kills u if u get near it

1 Like

Alright So Basically Remove attack() at line 79

1 Like

That makes it where they never move and just stand there

Oh My bad didnt see that try this; On line 66 change the 0 to 100 and it shouldnt kill the player

But I’m trying to make it where the jump scare plays when u die by the monster

So from my understanding, you have a separate script where, when the player touches the enemy, a jumpscare will play, but since your character died before being able to touch it, it’s not playing?

Yea so how do I make it where it plays when it gets touched by the other script not the jump scare script

You can make the jumpscare script a ModuleScript, make a play function in it or something that will cause the jumpscare to play, then require the module in the AI script and call that play function or whatever between lines 63 and 67

Since you already have the code that kills the player, just fire a remote event to the players client and have it play from there. Make sure the gui has the “ResetOnSpawn” set to false

So after line 66, you could check if the enemy is a player. If it is, fire the event.

Example:

humanoid.Health = 0
local thisPlayer = PlayerService:GetPlayerFromCharacter(humanoid.Parent)
if thisPlayer ~= nil then
    jumpScareEvent:FireClient(thisPlayer)
end
2 Likes