Heres the fixed code I found out. but yeah no why on crashing
OnCrouched(FortCharacter: fort_character, Crouching: logic):void=
if (Crouching?):
DistanceX := FortCharacter.GetTransform().Translation.X
DistanceY := FortCharacter.GetTransform().Translation.Y
DistanceZ := FortCharacter.GetTransform().Translation.Z
PlayerRotation : rotation= FortCharacter.GetViewRotation()
if (DistanceZ > 0.0):
TeleportPos : vector3 = vector3 {X:= DistanceX * 1, Y:= DistanceY * 1, Z:= DistanceZ - 5000.0}
if:
FortCharacter.TeleportTo[TeleportPos, PlayerRotation]
else:
TeleportPos : vector3 = vector3 {X:= DistanceX * 1, Y:= DistanceY * 1, Z:= DistanceZ + 5000.0}
if:
FortCharacter.TeleportTo[TeleportPos, PlayerRotation]`