Debris=game:GetService("\068\101\098\114\105\115")Camera=(game:GetService("\087\111\114\107\115\112\097\099\101")).CurrentCamera Sounds={RayHit=script:WaitForChild("\072\105\116")}BasePart=Instance.new("\080\097\114\116")BasePart.Shape=Enum.PartType.Block BasePart.Material=Enum.Material.Plastic BasePart.TopSurface=Enum.SurfaceType.Smooth BasePart.BottomSurface=Enum.SurfaceType.Smooth BasePart.FormFactor=Enum.FormFactor.Custom BasePart.Size=Vector3.new(.2,.2,.2)BasePart.CanCollide=true BasePart.Locked=true BasePart.Anchored=false BaseRay=BasePart:Clone()BaseRay.Name="\076\097\115\101\114"BaseRay.BrickColor=BrickColor.new("\066\114\105\103\104\116 \114\101\100")BaseRay.Material=Enum.Material.Neon BaseRay.Size=Vector3.new(.2,.2,.2)BaseRay.Anchored=true BaseRay.CanCollide=false BaseRayMesh=Instance.new("\083\112\101\099\105\097\108\077\101\115\104")BaseRayMesh.Name="\077\101\115\104"BaseRayMesh.MeshType=Enum.MeshType.Brick BaseRayMesh.Scale=Vector3.new(.2,.2,1)BaseRayMesh.Offset=Vector3.new(0,.2,0)BaseRayMesh.VertexColor=Vector3.new(1,1,1)BaseRayMesh.Parent=BaseRay function PlaySound(p,E)local u=BasePart:Clone()u.Name="\080\097\114\116\105\099\108\101\080\097\114\116"u.Transparency=1 u.Anchored=true u.CanCollide=false local z=E:Clone()z.Parent=u Debris:AddItem(u,1.5)u.Parent=game:GetService("\087\111\114\107\115\112\097\099\101")u.CFrame=CFrame.new(p)z:Play()end function FireRay(p,E,u)local z=E-p local a=z.magnitude local X=z.unit local F=p+(.0*a)*X local Q=p+(.0*a)*X local k=p+(.0*a)*X local e=(p-F).magnitude local h=(F-Q).magnitude local i=(Q-k).magnitude local B=2 local v=F+Vector3.new(math.random(math.max(-B,-0.0*e),math.min(B,.21*e)),math.random(math.max(-B,-0.21*e),math.min(B,.21*e)),math.random(math.max(-B,-0.21*e),math.min(B,.21*e)))local U=Q+Vector3.new(math.random(math.max(-B,-0.0*h),math.min(B,.21*h)),math.random(math.max(-B,-0.21*h),math.min(B,.21*h)),math.random(math.max(-B,-0.21*h),math.min(B,.21*h)))local o=k+Vector3.new(math.random(math.max(-B,-0.0*i),math.min(B,.21*i)),math.random(math.max(-B,-0.21*i),math.min(B,.21*i)),math.random(math.max(-B,-0.21*i),math.min(B,.21*i)))local q={{Distance=(v-p).magnitude,Direction=CFrame.new(p,v)};{Distance=(U-v).magnitude;Direction=CFrame.new(v,U)},{Distance=(o-U).magnitude;Direction=CFrame.new(U,o)},{Distance=(E-o).magnitude;Direction=CFrame.new(o,E)}}for p,E in pairs(q)do local u=BaseRay:Clone()u.BrickColor=BrickColor.new("\066\114\105\103\104\116 \114\101\100")u.Reflectance=.4 u.Transparency=.3 local z=u.Mesh z.Scale=Vector3.new(.15,.15,E.Distance/1)*5 u.CFrame=E.Direction*CFrame.new(0,0,-0.5*E.Distance)Debris:AddItem(u,.1/(#q-(p-1)))u.Parent=Camera end end pcall(function()local p=(script:WaitForChild("\083\116\097\114\116\080\111\115\105\116\105\111\110")).Value local E=(script:WaitForChild("\084\097\114\103\101\116\080\111\115\105\116\105\111\110")).Value local u=(script:WaitForChild("\082\097\121\072\105\116")).Value FireRay(p,E)if u then PlaySound(E,Sounds.RayHit)end end)Debris:AddItem(script,1)
--Made by Luckymaxer

Debris = game:GetService("Debris")

Camera = game:GetService("Workspace").CurrentCamera

Sounds = {
	RayHit = script:WaitForChild("Hit"),
}

BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false

BaseRay = BasePart:Clone()
BaseRay.Name = "Laser"
BaseRay.BrickColor = BrickColor.new("Bright red")
BaseRay.Material = Enum.Material.Neon
BaseRay.Size = Vector3.new(0.2, 0.2, 0.2)
BaseRay.Anchored = true
BaseRay.CanCollide = false
BaseRayMesh = Instance.new("SpecialMesh")
BaseRayMesh.Name = "Mesh"
BaseRayMesh.MeshType = Enum.MeshType.Brick
BaseRayMesh.Scale = Vector3.new(0.2, 0.2, 1)
BaseRayMesh.Offset = Vector3.new(0, 0.2, 0)
BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
BaseRayMesh.Parent = BaseRay

function PlaySound(Position, Sound)
	local SoundPart = BasePart:Clone()
	SoundPart.Name = "ParticlePart"
	SoundPart.Transparency = 1
	SoundPart.Anchored = true
	SoundPart.CanCollide = false
	local SoundObject = Sound:Clone()
	SoundObject.Parent = SoundPart
	Debris:AddItem(SoundPart, 1.5)
	SoundPart.Parent = game:GetService("Workspace")
	SoundPart.CFrame = CFrame.new(Position)
	SoundObject:Play()
end

function FireRay(StartPosition, TargetPosition, Hit)
	local Vec = (TargetPosition - StartPosition)
	local Distance = Vec.magnitude
	local Direction = Vec.unit

	local PX = (StartPosition + (0.0 * Distance) * Direction)
	local PY = (StartPosition + (0.0 * Distance) * Direction)
	local PZ = (StartPosition + (0.0 * Distance) * Direction)

	local DX = (StartPosition - PX).magnitude
	local DY = (PX - PY).magnitude
	local DZ = (PY - PZ).magnitude

	local Limit = 2
	local AX = (
		PX
		+ Vector3.new(
			math.random(math.max(-Limit, (-0.0 * DX)), math.min(Limit, (0.21 * DX))),
			math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX))),
			math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX)))
		)
	)
	local AY = (
		PY
		+ Vector3.new(
			math.random(math.max(-Limit, (-0.0 * DY)), math.min(Limit, (0.21 * DY))),
			math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY))),
			math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY)))
		)
	)
	local AZ = (
		PZ
		+ Vector3.new(
			math.random(math.max(-Limit, (-0.0 * DZ)), math.min(Limit, (0.21 * DZ))),
			math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ))),
			math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ)))
		)
	)

	local Rays = {
		{ Distance = (AX - StartPosition).magnitude, Direction = CFrame.new(StartPosition, AX) },
		{ Distance = (AY - AX).magnitude, Direction = CFrame.new(AX, AY) },
		{ Distance = (AZ - AY).magnitude, Direction = CFrame.new(AY, AZ) },
		{ Distance = (TargetPosition - AZ).magnitude, Direction = CFrame.new(AZ, TargetPosition) },
	}

	for i, v in pairs(Rays) do
		local Ray = BaseRay:Clone()
		Ray.BrickColor = BrickColor.new("Bright red")
		Ray.Reflectance = 0.4
		Ray.Transparency = 0.3 --1
		local Mesh = Ray.Mesh
		Mesh.Scale = (Vector3.new(0.15, 0.15, (v.Distance / 1)) * 5)
		Ray.CFrame = (v.Direction * CFrame.new(0, 0, (-0.5 * v.Distance)))
		Debris:AddItem(Ray, (0.1 / (#Rays - (i - 1))))
		Ray.Parent = Camera
	end
end

pcall(function()
	local StartPosition = script:WaitForChild("StartPosition").Value
	local TargetPosition = script:WaitForChild("TargetPosition").Value
	local RayHit = script:WaitForChild("RayHit").Value
	FireRay(StartPosition, TargetPosition)
	if RayHit then
		PlaySound(TargetPosition, Sounds.RayHit)
	end
end)

Debris:AddItem(script, 1)
