Laser not going across the screen

Yeah, I’m making a top down Gamemode but im experiencing some problems with the laser weapon.

EG: P = player
— = Lazer

         /--------------\
       |_____---P__|
         \--------------/

As you can (hopefully) see, the laser goes back to the crosshair and not across the screen.

Any help?

We can’t do anything without the code, so post it.

[lua]function SWEP:PrimaryAttack()

if ( !self:CanPrimaryAttack() ) then return end

self.Weapon:EmitSound(Sound(“ambient/energy/zap1.wav”))

self:TakePrimaryAmmo( 0 )

local trace = self.Owner:GetEyeTrace()
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetNormal( trace.HitNormal )
effectdata:SetEntity( trace.Entity )
effectdata:SetAttachment( trace.PhysicsBone )
effectdata:SetStart( self.Owner:GetShootPos() ) // this is where the problem occurs but i don’t know how to fix
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Weapon )
util.Effect( “ToolTracer”, effectdata )
if (SERVER) then
local owner=self.Owner
if self.Owner.SENT then
owner=self.Owner.SENT.Entity
end

end
end[/lua]

Any help?

Try this: [lua]function SWEP:PrimaryAttack()

if ( !self:CanPrimaryAttack() ) then return end

self.Weapon:EmitSound(Sound("ambient/energy/zap1.wav"))
self:TakePrimaryAmmo( 0 )

local owner = self.Owner
local pos = owner:GetShootPos()
local vec = owner:GetForward()
local tracedata = {}
tracedata.start = pos
tracedata.endpos = pos + vec * 2048 --The length of the laser
tracedata.filter = owner
local trace = util.TraceLine(tracedata)

local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetNormal( trace.HitNormal )
effectdata:SetEntity( trace.Entity )
effectdata:SetAttachment( trace.PhysicsBone )
effectdata:SetStart( owner:GetShootPos() )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Weapon )
util.Effect( "ToolTracer", effectdata )

if (SERVER) then
	local owner=self.Owner
	if self.Owner.SENT then
		owner=self.Owner.SENT.Entity
	end
end

end[/lua]

holy crap!

It worked :ddd