Tool=script.Parent Handle=Tool:WaitForChild("\072\097\110\100\108\101")Light=Handle:WaitForChild("\076\105\103\104\116")Players=game:GetService("\080\108\097\121\101\114\115")Debris=game:GetService("\068\101\098\114\105\115")CastLaser=(Tool:WaitForChild("\067\097\115\116\076\097\115\101\114")):Clone()Modules=Tool:WaitForChild("\077\111\100\117\108\101\115")Functions=require(Modules:WaitForChild("\070\117\110\099\116\105\111\110\115"))BaseUrl="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061"ConfigurationBin=Tool:WaitForChild("\067\111\110\102\105\103\117\114\097\116\105\111\110")Configuration={}Configuration=Functions.CreateConfiguration(ConfigurationBin,Configuration)ToolEquipped=false Remotes=Tool:WaitForChild("\082\101\109\111\116\101\115")Sounds={Fire=Handle:WaitForChild("\070\105\114\101")}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="\082\097\121"BaseRay.BrickColor=BrickColor.new("\067\071\065 \066\114\111\119\110")BaseRay.Material=Enum.Material.SmoothPlastic 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,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(C,Q)if not C or not C.Parent then return end local A=C.Parent if A:IsA("\072\097\116")then A=A.Parent end if A==Character then return end local m=A:FindFirstChild("\072\117\109\097\110\111\105\100")if not m or m.Health==0 then return end local L=Players:GetPlayerFromCharacter(A)if L and Functions.IsTeamMate(Player,L)then return end local Y=math.random(Configuration.Damage.MinValue,Configuration.Damage.MaxValue)Functions.UntagHumanoid(m)Functions.TagHumanoid(m,Player)m:TakeDamage(Y)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(C,Q)local A=nil pcall(function()A=ClientControl:InvokeClient(Player,C,Q)end)return A end ServerControl.OnServerInvoke=function(C,Q,A)if C~=Player or not ToolEquipped or not CheckIfAlive()or not Q or not A then return end if Q=="\070\105\114\101"then Sounds.Fire:Play()elseif Q=="\082\097\121\072\105\116"then local C=A.Hit local Q=A.Position if C and Q then RayTouched(C,Q)end Light.Color=BaseRay.BrickColor.Color if not Light.Enabled then Light.Enabled=true Delay(.1,function()Light.Enabled=false end)end elseif Q=="\067\097\115\116\076\097\115\101\114"then local C=A.StartPosition local Q=A.TargetPosition local m=A.RayHit if not C or not Q or not m then return end for A,m in pairs(Players:GetPlayers())do if m:IsA("\080\108\097\121\101\114")and m~=Player then local A=m:FindFirstChild("\066\097\099\107\112\097\099\107")if A then local m=CastLaser:Clone()local L=Instance.new("\086\101\099\116\111\114\051\086\097\108\117\101")L.Name="\083\116\097\114\116\080\111\115\105\116\105\111\110"L.Value=C L.Parent=m local Y=Instance.new("\086\101\099\116\111\114\051\086\097\108\117\101")Y.Name="\084\097\114\103\101\116\080\111\115\105\116\105\111\110"Y.Value=Q Y.Parent=m local q=Instance.new("\066\111\111\108\086\097\108\117\101")q.Name="\082\097\121\072\105\116"q.Value=q q.Parent=m m.Disabled=false Debris:AddItem(m,1.5)m.Parent=A end end end end end Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)


Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Light = Handle:WaitForChild("Light")

Players = game:GetService("Players")
Debris = game:GetService("Debris")

CastLaser = Tool:WaitForChild("CastLaser"):Clone()

Modules = Tool:WaitForChild("Modules")
Functions = require(Modules:WaitForChild("Functions"))
BaseUrl = "http://www.roblox.com/asset/?id="

ConfigurationBin = Tool:WaitForChild("Configuration")
Configuration = {}
Configuration = Functions.CreateConfiguration(ConfigurationBin, Configuration)

ToolEquipped = false

Remotes = Tool:WaitForChild("Remotes")

Sounds = {
	Fire = Handle:WaitForChild("Fire"),
}

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 = "Ray"
BaseRay.BrickColor = BrickColor.new("CGA Brown")
BaseRay.Material = Enum.Material.SmoothPlastic
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, 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 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:FindFirstChild("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)
	humanoid:TakeDamage(DeterminedDamage)
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()
	elseif Mode == "RayHit" then
		local RayHit = Value.Hit
		local RayPosition = Value.Position
		if RayHit and RayPosition then
			RayTouched(RayHit, RayPosition)
		end
		Light.Color = BaseRay.BrickColor.Color
		if not Light.Enabled then
			Light.Enabled = true
			Delay(0.1, function()
				Light.Enabled = false
			end)
		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)
