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