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,0,0)BaseRayMesh.VertexColor=Vector3.new(1,1,1)BaseRayMesh.Parent=BaseRay ServerControl=Remotes:FindFirstChild("\083\101\114\118\101\114\067\111\110\116\114\111\108")or Instance.new("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")ServerControl.Name="\083\101\114\118\101\114\067\111\110\116\114\111\108"ServerControl.Parent=Remotes ClientControl=Remotes:FindFirstChild("\067\108\105\101\110\116\067\111\110\116\114\111\108")or Instance.new("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")ClientControl.Name="\067\108\105\101\110\116\067\111\110\116\114\111\108"ClientControl.Parent=Remotes Light.Enabled=false Tool.Enabled=true function RayTouched(q,K)if Configuration.DestroyParts.Value then q:Destroy()end if Configuration.SuperPartDestruction.Value then q.Archivable=false q:Destroy()end if not q or not q.Parent then return end local k=q.Parent if k:IsA("\072\097\116")then k=k.Parent end if k==Character then return end local B=k:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if not B or B.Health==0 then return end local f=Players:GetPlayerFromCharacter(k)if f and Functions.IsTeamMate(Player,f)then return end local H=math.random(Configuration.Damage.MinValue,Configuration.Damage.MaxValue)Functions.UntagHumanoid(B)Functions.TagHumanoid(B,Player)if Configuration.InstantKill.Value then B.Health=0 end if Configuration.IgnoreForceField.Value then if q.Name=="\072\101\097\100"then B.Health=B.Health-math.random(Configuration.Damage.MinValue,Configuration.Damage.MaxValue)*Configuration.HeadShotMultiplier.Value Sounds.HeadShot:Play()else B.Health=B.Health-math.random(Configuration.Damage.MinValue,Configuration.Damage.MaxValue)end else if q.Name=="\072\101\097\100"then B:TakeDamage(H*Configuration.HeadShotMultiplier.Value)Sounds.HeadShot:Play()else B:TakeDamage(H)end end end function CheckIfAlive()return(Player and(Player.Parent and(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and Humanoid.Health>0))))))and true or false end function Equipped()Character=Tool.Parent Player=Players:GetPlayerFromCharacter(Character)Humanoid=Character:FindFirstChild("\072\117\109\097\110\111\105\100")if not CheckIfAlive()then return end ToolEquipped=true end function Unequipped()ToolEquipped=false end function InvokeClient(q,K)local k=nil pcall(function()k=ClientControl:InvokeClient(Player,q,K)end)return k end ServerControl.OnServerInvoke=function(q,K,k)if q~=Player or not ToolEquipped or not CheckIfAlive()or not K or not k then return end if K=="\070\105\114\101"then Sounds.Fire:Play()FX:Emit(3)if Configuration.AddRecoil.Value then if Recoil.Disabled then Recoil.Disabled=false delay(.1,function()Recoil.Disabled=true end)end end elseif K=="\082\097\121\072\105\116"then local q=k.Hit local K=k.Position if q and K then RayTouched(q,K)end elseif K=="\067\097\115\116\076\097\115\101\114"then local q=k.StartPosition local K=k.TargetPosition local B=k.RayHit if not q or not K or not B then return end for k,B in pairs(Players:GetPlayers())do if B:IsA("\080\108\097\121\101\114")and B~=Player then local k=B:FindFirstChild("\066\097\099\107\112\097\099\107")if k then local B=CastLaser:Clone()local f=Instance.new("\086\101\099\116\111\114\051\086\097\108\117\101")f.Name="\083\116\097\114\116\080\111\115\105\116\105\111\110"f.Value=q f.Parent=B local H=Instance.new("\086\101\099\116\111\114\051\086\097\108\117\101")H.Name="\084\097\114\103\101\116\080\111\115\105\116\105\111\110"H.Value=K H.Parent=B local z=Instance.new("\066\111\111\108\086\097\108\117\101")z.Name="\082\097\121\072\105\116"z.Value=z z.Parent=B B.Disabled=false Debris:AddItem(B,1.5)B.Parent=k end end end end end Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)

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, 0)
BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
BaseRayMesh.Parent = BaseRay

ServerControl = (Remotes:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Remotes

ClientControl = (Remotes:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Remotes

Light.Enabled = false
Tool.Enabled = true

function RayTouched(Hit, Position)
	if Configuration.DestroyParts.Value then
		Hit:Destroy()
	end
	if Configuration.SuperPartDestruction.Value then
		Hit.Archivable = false
		Hit:Destroy()
	end
	if not Hit or not Hit.Parent then
		return
	end
	local character = Hit.Parent
	if character:IsA("Hat") then
		character = character.Parent
	end
	if character == Character then
		return
	end
	local humanoid = character:FindFirstChildOfClass('Humanoid')
	if not humanoid  or humanoid.Health == 0 then
		return
	end
	local player = Players:GetPlayerFromCharacter(character)
	if player and Functions.IsTeamMate(Player, player) then
		return
	end
	local DeterminedDamage = math.random(Configuration.Damage.MinValue, Configuration.Damage.MaxValue)
	Functions.UntagHumanoid(humanoid)
	Functions.TagHumanoid(humanoid, Player)
	if Configuration.InstantKill.Value then
		humanoid.Health = 0
	end
	
	if Configuration.IgnoreForceField.Value then
		if Hit.Name == 'Head' then
			humanoid.Health = humanoid.Health - math.random(Configuration.Damage.MinValue, Configuration.Damage.MaxValue) * Configuration.HeadShotMultiplier.Value
			Sounds.HeadShot:Play()
		else
			humanoid.Health = humanoid.Health - math.random(Configuration.Damage.MinValue, Configuration.Damage.MaxValue)
		end
	else
		if Hit.Name == 'Head' then
			humanoid:TakeDamage(DeterminedDamage * Configuration.HeadShotMultiplier.Value)
			Sounds.HeadShot:Play()
		else
			humanoid:TakeDamage(DeterminedDamage)
		end
	end
end

function CheckIfAlive()
	return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	if not CheckIfAlive() then
		return
	end
	ToolEquipped = true
end

function Unequipped()
	ToolEquipped = false
end

function InvokeClient(Mode, Value)
	local ClientReturn = nil
	pcall(function()
		ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
	end)
	return ClientReturn
end

ServerControl.OnServerInvoke = (function(player, Mode, Value)
	if player ~= Player or not ToolEquipped or not CheckIfAlive() or not Mode or not Value then
		return
	end
	if Mode == "Fire" then
		Sounds.Fire:Play()
		FX:Emit(3)
		if Configuration.AddRecoil.Value then
			if Recoil.Disabled then 
				Recoil.Disabled = false
				delay(0.1, function()
					Recoil.Disabled = true
				end)
			end
		end
	elseif Mode == "RayHit" then
		local RayHit = Value.Hit
		local RayPosition = Value.Position
		if RayHit and RayPosition then
			RayTouched(RayHit, RayPosition)
		end
	elseif Mode == "CastLaser" then
		local StartPosition = Value.StartPosition
		local TargetPosition = Value.TargetPosition
		local RayHit = Value.RayHit
		if not StartPosition or not TargetPosition or not RayHit then
			return
		end
		for i, v in pairs(Players:GetPlayers()) do
			if v:IsA("Player") and v ~= Player then
				local Backpack = v:FindFirstChild("Backpack")
				if Backpack then
					local LaserScript = CastLaser:Clone()
					local StartPos = Instance.new("Vector3Value")
					StartPos.Name = "StartPosition"
					StartPos.Value = StartPosition
					StartPos.Parent = LaserScript
					local TargetPos = Instance.new("Vector3Value")
					TargetPos.Name = "TargetPosition"
					TargetPos.Value = TargetPosition
					TargetPos.Parent = LaserScript
					local RayHit = Instance.new("BoolValue")
					RayHit.Name = "RayHit"
					RayHit.Value = RayHit
					RayHit.Parent = LaserScript
					LaserScript.Disabled = false
					Debris:AddItem(LaserScript, 1.5)
					LaserScript.Parent = Backpack
				end
			end
		end
	end
end)

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
