local L=196.2 local w=tool.Configurations.ReloadTime.Value local s=tool.Configurations.RocketSpeed.Value local F="\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\050\050\053\049\053\051\052"local m=Vector3.new(.35,.35,.25)local H=Vector3.new(1.2,1.2,3.27)local g=script:WaitForChild("\082\111\099\107\101\116")local u=script:WaitForChild("\083\119\111\111\115\104")local t=script:WaitForChild("\066\111\111\109")local S=tool.Configurations.AttackCooldown.Value local N=tool.Configurations.Damage.Value local y=tool.Configurations.ReloadTime.Value local function f(L)local w=game.ReplicatedStorage:FindFirstChild(L)if not w then w=Instance.new("\082\101\109\111\116\101\069\118\101\110\116",game.ReplicatedStorage)w.Name=L end return w end local C=f("\082\079\066\076\079\088\095\082\111\099\107\101\116\085\112\100\097\116\101\069\118\101\110\116")local z=f("\082\079\066\076\079\088\095\082\111\099\107\101\116\069\113\117\105\112\069\118\101\110\116")local c=f("\082\079\066\076\079\088\095\082\111\099\107\101\116\085\110\101\113\117\105\112\069\118\101\110\116")local n=f("\082\079\066\076\079\088\095\082\111\099\107\101\116\070\105\114\101\069\118\101\110\116")C.OnServerEvent:connect(function(L,w,s)local F=L.Character local m=F.Humanoid if m.Health<=0 then return end if m.RigType==Enum.HumanoidRigType.R6 then F.Torso.Neck.C0=w;(F.Torso:FindFirstChild("\082\105\103\104\116 \083\104\111\117\108\100\101\114")).C0=s gunWeld=(F:FindFirstChild("\082\105\103\104\116 \065\114\109")):WaitForChild("\082\105\103\104\116\071\114\105\112")elseif m.RigType==Enum.HumanoidRigType.R15 then F.Head.Neck.C0=w F.RightUpperArm.RightShoulder.C0=s gunWeld=F.RightHand:WaitForChild("\082\105\103\104\116\071\114\105\112")end end)z.OnServerEvent:connect(function(L)L.Character.Humanoid.AutoRotate=false end)c.OnServerEvent:connect(function(L)L.Character.Humanoid.AutoRotate=true end)


local GRAVITY_ACCELERATION = 196.2

local RELOAD_TIME = tool.Configurations.ReloadTime.Value -- Seconds until tool can be used again
local ROCKET_SPEED = tool.Configurations.RocketSpeed.Value -- Speed of the projectile

local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)

local RocketScript = script:WaitForChild('Rocket')
local SwooshSound = script:WaitForChild('Swoosh')
local BoomSound = script:WaitForChild('Boom')

local attackCooldown = tool.Configurations.AttackCooldown.Value
local damage = tool.Configurations.Damage.Value
local reloadTime = tool.Configurations.ReloadTime.Value

local function createEvent(eventName)
	local event = game.ReplicatedStorage:FindFirstChild(eventName)
	if not event then
		event = Instance.new("RemoteEvent", game.ReplicatedStorage)
		event.Name = eventName
	end
	return event
end

local updateEvent = createEvent("ROBLOX_RocketUpdateEvent")
local equipEvent = createEvent("ROBLOX_RocketEquipEvent")
local unequipEvent = createEvent("ROBLOX_RocketUnequipEvent")
local fireEvent = createEvent("ROBLOX_RocketFireEvent")

updateEvent.OnServerEvent:connect(function(player, neckC0, rshoulderC0)
	local character = player.Character
	local humanoid = character.Humanoid
	
	if humanoid.Health <= 0 then return end
	
	if humanoid.RigType == Enum.HumanoidRigType.R6 then
		character.Torso.Neck.C0 = neckC0
		character.Torso:FindFirstChild("Right Shoulder").C0 = rshoulderC0
		gunWeld = character:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
	
	elseif humanoid.RigType == Enum.HumanoidRigType.R15 then
		character.Head.Neck.C0 = neckC0
		character.RightUpperArm.RightShoulder.C0 = rshoulderC0
		gunWeld = character.RightHand:WaitForChild("RightGrip")
	end
end)

equipEvent.OnServerEvent:connect(function(player)
	player.Character.Humanoid.AutoRotate = false
end)

unequipEvent.OnServerEvent:connect(function(player)
	player.Character.Humanoid.AutoRotate = true
end)
