local l=game:GetService("\067\111\108\108\101\099\116\105\111\110\083\101\114\118\105\099\101")local a=game:GetService("\068\101\098\114\105\115")local function d(d,u)if Tool.Enabled==false then return end local n=ModFx.GetPlayerFromTool(Tool)if d~=n then return end local K=d.Character if not K then return end local X=K:FindFirstChildWhichIsA("\072\117\109\097\110\111\105\100")local U=K:FindFirstChildWhichIsA("\084\111\111\108")local E=K:FindFirstChild("\072\101\097\100")if not E or not U or not X then return end if U~=Tool then return end if X.Health<=0 then return end Tool.Enabled=false local I=u-E.Position I=I*(1/I.magnitude)local W=E.Position+I*8 local w=5000 local y=Rocket:clone()y.Name="\082\111\099\107\101\116"local G=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")G.Parent=y G.P=12500 G.MaxForce=Vector3.new(w,w,w)G.Velocity=I*60 y.CFrame=CFrame.new(W,W+I)local L=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")L.Value=d L.Name="\099\114\101\097\116\111\114"L.Parent=y local O=Tool.Handle.exp:Clone()O.PlaybackSpeed=math.random(90,110)/100 O.PlayOnRemove=true O.Parent=y local D=Tool.Handle.swoosh:Clone()D.PlaybackSpeed=math.random(95,105)/100 D.Parent=y y.Parent=workspace l:AddTag(y,y.Name)l:AddTag(y,d.Name)y:SetNetworkOwner(d)D:Play()local s=d:FindFirstChild("\069\102\102\101\099\116")if s and s.Value~="\078\111\110\101"then if s.Value=="\070\105\114\101"then Instance.new("\070\105\114\101",y)else spawn(function()(require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")).TrailModule)).AddTrail(y,s.Value,.5,.5,1)end)end end a:AddItem(y,10)wait(7)Tool.Enabled=true end Tool.Fire.OnServerEvent:Connect(d)local function u(d,u,n)local K=true local X,U=pcall(function()if u:GetNetworkOwner()~=d then K=false end end)if U then warn(d.Name.." \109\097\121 \098\101 \101\120\112\108\111\105\116\105\110\103")return end if K==false then warn(d.Name.." \105\115 \100\101\102\105\110\105\116\101\108\121 \101\120\112\108\111\105\116\105\110\103")return end local E=u.Position local I=u:FindFirstChild("\099\114\101\097\116\111\114")local W if I then W=I.Value end local w=ModFx.GetPlayerFromTool(Tool)if W~=nil and(W==d and(w and(w==d and((E-n).magnitude<20 and(l:HasTag(u,u.Name)and l:HasTag(u,d.Name))))))then u:ClearAllChildren()a:AddItem(u,0)ModFx.Explosion(W,"\082\111\099\107\101\116",n)end end Tool.RocketDestroyEvent.OnServerEvent:connect(u)

local ColSer=game:GetService("CollectionService")
local Debris=game:GetService("Debris")

local function FireWep(plr,targetPos)
	if Tool.Enabled==false then return end
	local Player=ModFx.GetPlayerFromTool(Tool)
	if plr~=Player then return end
	local c=plr.Character
	if not c then return end
	local h=c:FindFirstChildWhichIsA("Humanoid")
	local plrTool=c:FindFirstChildWhichIsA("Tool")
	local Head=c:FindFirstChild("Head")
	if not Head or not plrTool or not h then return end
	if plrTool~=Tool then return end
	if h.Health<=0 then return end
	
	Tool.Enabled=false
	
	local dir = targetPos - Head.Position
	dir = dir*(1/dir.magnitude)
	
	local pos = Head.Position + (dir * 8)
	local ad=5000

	local missile = Rocket:clone()
	missile.Name="Rocket"
	
	local BV=Instance.new("BodyVelocity")
	BV.Parent=missile
	BV.P=12500
	BV.MaxForce=Vector3.new(ad,ad,ad)
	BV.Velocity=dir*60
	missile.CFrame = CFrame.new(pos,  pos + dir)
	
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = plr
	creator_tag.Name = "creator"
	creator_tag.Parent = missile
	
	local exp=Tool.Handle.exp:Clone()
	exp.PlaybackSpeed=math.random(90,110)/100
	exp.PlayOnRemove=true
	exp.Parent=missile
	
	local swoosh=Tool.Handle.swoosh:Clone()
	swoosh.PlaybackSpeed=math.random(95,105)/100
	swoosh.Parent=missile

	missile.Parent = workspace
	ColSer:AddTag(missile,missile.Name) 
	ColSer:AddTag(missile,plr.Name)
	missile:SetNetworkOwner(plr)
	swoosh:Play()
	
	local effect=plr:FindFirstChild("Effect")
	if effect and effect.Value~="None" then
		if effect.Value=="Fire" then
			Instance.new("Fire",missile)
		else
			spawn(function()
				require(game:GetService("ReplicatedStorage").TrailModule).AddTrail(missile,effect.Value,.5,.5,1)
			end)
		end
	end
	Debris:AddItem(missile,10)
	wait(7)
	Tool.Enabled=true
end

Tool.Fire.OnServerEvent:Connect(FireWep)

local function DestroyRocket(plr,Obj,ClientPos)
	local x=true
	local succ,err=pcall(function() 
		if Obj:GetNetworkOwner()~=plr then x=false end 
	end) 
	if err then warn(plr.Name.." may be exploiting") return end -- Not sure how this would happen.
	if x==false then warn(plr.Name.." is definitely exploiting") --[[plr:Kick("Possible exploit detected")]] return end
	--[[ Why am I so confident that they're an exploiter if x==false? Because the network owner of the rocket is SET (as opposed to using auto 
	network ownership) to the rocket's firer, and so if the part this remote is firing upon is NOT owned by the user firing the remote, then I 
	know the remote is being fired externally. ]]
	local ServerPos=Obj.Position
	local creator=Obj:FindFirstChild("creator")
	local CreatorValue
	if creator then
		CreatorValue=creator.Value
	end
	local Player=ModFx.GetPlayerFromTool(Tool)
	if CreatorValue~=nil and CreatorValue==plr and Player and Player==plr and (ServerPos - ClientPos).magnitude < 20 and ColSer:HasTag(Obj,Obj.Name) 
	and ColSer:HasTag(Obj,plr.Name) then -- all these to ensure that it's a rocket, and its their rocket, and its from their tool
		-- "(ServerPos - ClientPos).magnitude" = the distance between the serverside and clientside missile on hit
		Obj:ClearAllChildren()
		Debris:AddItem(Obj,0)
		ModFx.Explosion(CreatorValue,"Rocket",ClientPos)
	end
end

Tool.RocketDestroyEvent.OnServerEvent:connect(DestroyRocket)
