i need help with script slenderman i new

Hello I need help with a script about slenderman I’m new in programming and a friend sent me the code and I have one error
this
if ( !isInRange )
{
rigidbody.velocity = Vector3( 0, rigidbody.velocity.y, 0 ); // maintain gravity

// –
// Old Movement
//transform.LookAt( thePlayer );
//transform.position += transform.forward * speed * Time.deltaTime;
// –

// New Movement - with obstacle avoidance
var dir : Vector3 = ( thePlayer.position - theEnemy.position ).normalized;
var hit : RaycastHit;

//and

function StopEnemy()
{
transform.LookAt( thePlayer );

Rigidbody.velocity = Vector3.zero;
}

function CheckIfVisible()
{

//and
if ( !hasPlayedSeenSound )
{
audio.PlayClipAtPoint( enemySightedSFX, thePlayer.position );
}
hasPlayedSeenSound = true; // sound has now played
}
else
{
// check max range
CheckMaxVisibleRange();

// if far away then move, else stop

Please use code tags and post the actual error and line number.

1 Like