Thanks

There's probably a better way to do it, but I wanted to stick to what you were doing instead of checking for a better way and making your code unreadable to you.
Anyway, I have modified the code. Try to figure it out first though. If you can't get it you can try this:
` Program creted by Eduardo Herrera
` July 2006
`set up
sync rate 40
sync on
autocam off
hide mouse
` make matrix
` this matrix is only for reference point
make matrix 1,30,30,30,30
`make target and color it
make object box 1,2,0.1,2 :
xrotate object 1,90
color object 1,rgb(10,10,10)
`make player
make object cylinder 2,1
color object 2,rgb(200,0,0)
` xrotate object 2,90
`make bullet
make object sphere 3,0.5
color object 3,rgb(0,250,0)
hide object 3
`initialize player position
playerxpos#=15
playerzpos#=15
`main program
do
`get position of mouse
posmousex#=mousex()
posmousez#=mousez()
`print on screen position of target
set cursor 0,0 : print "Get mouse to position 30 on x coordinates to start"
set cursor 0,15 : print "Position of mouse on x coordinates: ",posmousex#
set cursor 0,30 : print "Use mouse to move target left or right..."
set cursor 0,45 : print "Use cursor keys to move player left, right,up or down"
set cursor 0,60 : print "left mouse click to shoot"
set cursor 0,75 : print "BulletLife:",BulletLife
` mouse bounderies on x on the back side
if posmousex#<31 then posmousex#=31
if posmousex#>60 then posmousex#=60
` player stays in bounderies on x position
if playerxpos#=<0 then playerxpos#=0
if playerxpos#=>30 then playerxpos#=30
`player stays in bounderies on z position
if playerzpos#=<0 then playerzpos#=0
if playerzpos#=>30 then playerzpos#=30
` player movement
if rightkey()=1 and playerxpos#>=0 and playerxpos#=<30 then playerxpos#=playerxpos#+0.3
if leftkey()=1 and playerxpos#=>0 and playerxpos#=<30 then playerxpos#=playerxpos#-0.3
if upkey()=1 and playerzpos#>=0 and playerzpos#<=30 then playerzpos#=playerzpos#+0.3
if downkey()=1 and playerzpos#>=0 and playerzpos#<=30 then playerzpos#=playerzpos#-0.3
` bullet creation
if mouseclick()=1 and BulletLife=0
` position bullet in the gun
position object 3,playerxpos#,1,playerzpos#
set object to object orientation 3,2
`Make it so the bullet is alive
bulletlife=1
show object 3
`Reset the FLAG value when you shoot, just in case.
Hit=0
endif
`bullet path
if bulletlife>0
move object 3,0.5
`If the bullet has already hit the target, make it point towards the player
if Hit=1
point object 3,object position x(2),object position y(2),object position Z(2)
endif
endif
`Hide the bullet if it is not supposed to be visible
if bulletlife=0 then hide object 3
` collision detection
col_with_target=object collision(3,1)
`IT hit the target! Hit FLAG is now 1!
if col_with_target=1 and Hit=0 or Object position z(3)>Object position z(1) and Hit=0
Hit=1
endif
` collision detection with player
col_with_player=object collision(2,3)
`The bullet is done so kill and reset the flag.
if col_with_player=1 and Hit=1
BulletLife=0
Hit=0
endif
` positioning player
position object 2,playerxpos#,1,playerzpos#
` positioning target
position object 1,posmousex#-30,1,30
` positioning camera
position camera 15,20,-10
point camera 15,10,0
sync
loop
[Edit]
And while I'm at it, here's a version with better mouse movement for the Target. I found it a bit jumpy before. It uses MOUSEMOVEX(), which returns the strength of the player's mouse movement on the X axis. After it, you will see a "/10". That divides the strength for slower movement. Increase this number to make the movement slower, and decrease it to make it faster.
` Program creted by Eduardo Herrera
` July 2006
`set up
sync rate 40
sync on
autocam off
hide mouse
` make matrix
` this matrix is only for reference point
make matrix 1,30,30,30,30
`make target and color it
make object box 1,2,0.1,2 :
xrotate object 1,90
color object 1,rgb(10,10,10)
`make player
make object cylinder 2,1
color object 2,rgb(200,0,0)
` xrotate object 2,90
`make bullet
make object sphere 3,0.5
color object 3,rgb(0,250,0)
hide object 3
`initialize player position
playerxpos#=15
playerzpos#=15
`main program
do
`print on screen position of target
set cursor 0,0 : print "Get mouse to position 30 on x coordinates to start"
set cursor 0,30 : print "Use mouse to move target left or right..."
set cursor 0,45 : print "Use cursor keys to move player left, right,up or down"
set cursor 0,60 : print "left mouse click to shoot"
set cursor 0,75 : print "BulletLife:",BulletLife
` player stays in bounderies on x position
if playerxpos#=<0 then playerxpos#=0
if playerxpos#=>30 then playerxpos#=30
`player stays in bounderies on z position
if playerzpos#=<0 then playerzpos#=0
if playerzpos#=>30 then playerzpos#=30
` player movement
if rightkey()=1 and playerxpos#>=0 and playerxpos#=<30 then playerxpos#=playerxpos#+0.3
if leftkey()=1 and playerxpos#=>0 and playerxpos#=<30 then playerxpos#=playerxpos#-0.3
if upkey()=1 and playerzpos#>=0 and playerzpos#<=30 then playerzpos#=playerzpos#+0.3
if downkey()=1 and playerzpos#>=0 and playerzpos#<=30 then playerzpos#=playerzpos#-0.3
` bullet creation
if mouseclick()=1 and BulletLife=0
` position bullet in the gun
position object 3,playerxpos#,1,playerzpos#
set object to object orientation 3,2
`Make it so the bullet is alive
bulletlife=1
show object 3
`Reset the FLAG value when you shoot, just in case.
Hit=0
endif
`bullet path
if bulletlife>0
move object 3,0.5
`If the bullet has already hit the target, make it point towards the player
if Hit=1
point object 3,object position x(2),object position y(2),object position Z(2)
endif
endif
`Hide the bullet if it is not supposed to be visible
if bulletlife=0 then hide object 3
` collision detection
col_with_target=object collision(3,1)
`IT hit the target! Hit FLAG is now 1! I also colored the target red.
`You can take that out though.
if col_with_target=1 and Hit=0 and BulletLife=1
Hit=1
color object 1,rgb(255,0,0)
endif
rem If you missed the target, it still comes back to you.
if Object position z(3)>Object position z(1) and Hit=0
Hit=1
endif
` collision detection with player
col_with_player=object collision(2,3)
`The bullet is done so kill and reset the flag.
if col_with_player=1 and Hit=1 and BulletLife=1
BulletLife=0
Hit=0
endif
` positioning player
position object 2,playerxpos#,1,playerzpos#
MouseStrengthOnX#=mousemovex()/10
` positioning target
position object 1,Object position x(1)+MouseStrengthOnX#,1,30
`IF the object goes out of bounds, put it back in bounds.
if object position x(1)>30 then position object 1,30,object position y(1),object position z(1)
if object position x(1)<0 then position object 1,0,object position y(1),object position z(1)
` positioning camera
position camera 15,20,-10
point camera 15,10,0
sync
loop
[/Edit]