null
nil
-
false
true
0.0500000007
-1.31955695
-0.941427648
1
0
0
0
0.906307757
0.42261824
0
-0.42261824
0.906307757
Carnagecopia
http://www.roblox.com/asset/?id=98345995
Carnagecopia
-
false
-0.5
0.5
0
0
-0.5
0.5
0
0
194
23.9200001
78.125
-45.125
1
0
0
0
1
0
0
0
1
true
0.5
0.300000012
-0.5
0.5
0
0
-0.5
0.5
0
0
true
256
Handle
0
-0.5
0.5
0
0
0
0
0
-0.5
0.5
0
0
0
0
0
0
3
1
0.839999974
1.14999998
3.54999995
-
2
2
http://www.roblox.com/asset/?id=98331889
5
Mesh
0
0
0
2
2
2
http://www.roblox.com/asset/?id=98332070
1
1
1
-
false
ReloadSound
1
false
http://www.roblox.com/Asset?ID=94132726
1
-
false
Equip
1.33000004
false
http://www.roblox.com/Asset?ID=97103817
0.5
-
false
MouseIcon
local MOUSE_ICON = 'rbxasset://textures/GunCursor.png'
local RELOADING_ICON = 'rbxasset://textures/GunWaitCursor.png'
local Tool = script.Parent
local Mouse = nil
local function UpdateIcon()
Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
end
local function OnEquipped(mouse)
Mouse = mouse
UpdateIcon()
end
local function OnChanged(property)
if property == 'Enabled' then
UpdateIcon()
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Changed:connect(OnChanged)
-
false
Launcher
-----------------
--| Constants |--
-----------------
local COOLDOWN = 4 -- Seconds until tool can be used again
-- RocketPropulsion Fields
local TARGET_RADIUS = 5
local MAX_SPEED = 75
local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
local MAX_THRUST = 50000
local THRUST_P = 500
local THRUST_D = 50000
local TARGET_OVERSHOOT_DISTANCE = 10000000
local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=94690081'
local ROCKET_MESH_SCALE = Vector3.new(2, 2, 2)
local ROCKET_PART_SIZE = Vector3.new(2,2.4,1)
local VELOCITY = 110 -- constant
local VELOCITY_SQAURED = VELOCITY * VELOCITY
local VELOCITY_TO_FOURTH = VELOCITY_SQAURED * VELOCITY_SQAURED
--------------------
--| WaitForChild |--
--------------------
-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
-----------------
--| Variables |--
-----------------
local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')
local Tool = script.Parent
local ToolHandle = Tool.Handle
local RocketScript = WaitForChild(script, 'Rocket')
local SwooshSound = WaitForChild(script, 'Swoosh')
local BoomSound = WaitForChild(script, 'Boom')
local ReloadSound = WaitForChild(ToolHandle, 'ReloadSound')
local EquipSound
local MyModel = nil
local MyPlayer = nil
local BaseRocket = nil
local RocketClone = nil
local RocketMeshes = WaitForChild(Tool,'RocketMeshes')
local textGui=WaitForChild(Tool,'textGui')
local Kills=WaitForChild(Tool,'Kills')
local InUltra=false
-----------------
--| Functions |--
-----------------
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY_TO_FOURTH) - (g * ((g*dx*dx) + (2*dy*VELOCITY_SQAURED)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY_SQAURED) + root) / (g*dx)
local inATan2 = ((VELOCITY_SQAURED) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
return math.min(answer1,answer2)
end
local function MakeBaseRocket()
-- Set up the rocket part
local rocket = Instance.new('Part')
rocket.Name = 'Rocket'
rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
rocket.Size = ROCKET_PART_SIZE
rocket.CanCollide = false
rocket.BottomSurface = Enum.SurfaceType.Smooth
rocket.TopSurface = Enum.SurfaceType.Smooth
-- Add the mesh
local mesh = RocketMeshes[math.random(RocketMeshes.Value)]:Clone()--Instance.new('SpecialMesh', rocket)
--mesh.MeshId =
mesh.Scale = ROCKET_MESH_SCALE
--mesh.TextureId = ToolHandle.Mesh.TextureId
mesh.Parent=rocket
-- Add fire
local fire = Instance.new('Fire', rocket)
fire.Heat = 5
fire.Size = 2
local spin = Instance.new('BodyAngularVelocity')
spin.maxTorque=Vector3.new(999999,999999,999999)
spin.angularvelocity=Vector3.new(math.random()*30-15,math.random()*30-15,math.random()*30-15)
spin.Parent=rocket
-- Clone the sounds
local swooshSoundClone = SwooshSound:Clone()
swooshSoundClone.Parent = rocket
local boomSoundClone = BoomSound:Clone()
boomSoundClone.Parent = rocket
-- Attach creator tags
local creatorTag = Instance.new('ObjectValue', rocket)
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
creatorTag.Value = MyPlayer
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Name = 'icon'
iconTag.Value = Tool.TextureId
-- Finally, clone the rocket script and enable it
local rocketScriptClone = RocketScript:Clone()
rocketScriptClone.Parent = rocket
rocketScriptClone.Disabled = false
return rocket
end
local function OnEquipped()
MyModel = Tool.Parent
MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
BaseRocket = MakeBaseRocket()
RocketClone = BaseRocket:Clone()
EquipSound = WaitForChild(ToolHandle, 'Equip')
EquipSound:Play()
end
local function OnActivated(targetOverride)
if (Tool.Enabled or InUltra) and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
Tool.Enabled = false
-- Pick a target
local targetPosition = targetOverride or MyModel.Humanoid.TargetPoint
-- Position the rocket clone
local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.z / 2))
RocketClone.CFrame = CFrame.new(spawnPosition, targetPosition) --NOTE: This must be done before assigning Parent
DebrisService:AddItem(RocketClone, 30)
RocketClone.Parent = Workspace
local startPosition = spawnPosition
local mouse_pos=targetPosition
local dir = mouse_pos - startPosition
dir = dir.unit
local launch = startPosition + 3 * dir
local delta = mouse_pos - launch
local dy = delta.y
local new_delta = Vector3.new(delta.x, 0, delta.z)
delta = new_delta
local dx = delta.magnitude
local unit_delta = delta.unit
-- acceleration due to gravity in RBX units
local g = (-9.81 * 20)
local theta = computeLaunchAngle( dx, dy, g)
local vy = math.sin(theta)
local xz = math.cos(theta)
local vx = unit_delta.x * xz
local vz = unit_delta.z * xz
RocketClone.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
wait(0) --TODO: Remove when sounds realize they can be played as soon as they enter the Workspace
-- Swoosh!
local swooshSound = RocketClone:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Play()
end
-- Prepare the next rocket to be fired
BaseRocket:Destroy()
BaseRocket = MakeBaseRocket()
RocketClone = BaseRocket:Clone()
ReloadSound:Play()
if not InUltra then
wait(COOLDOWN)
end
-- Stop the reloading sound if it hasn't already finished
ReloadSound:Stop()
Tool.Enabled = true
end
end
local function OnUnequipped()
ReloadSound:Stop() --TODO: This does not work online
end
function updateUltra()
if Kills.Value>2 then
Kills.Value=0
InUltra=true
local tgui=textGui:Clone()
tgui.Parent=MyPlayer.PlayerGui
game.Debris:AddItem(tgui,10)
local startTime=tick()
while tick()-startTime<10 do
OnActivated()
wait(.5)
end
InUltra=false
end
end
--------------------
--| Script Logic |--
--------------------
Kills.Changed:connect(updateUltra)
Tool.Equipped:connect(OnEquipped)
Tool.Activated:connect(OnActivated)
Tool.Unequipped:connect(OnUnequipped)
Tool.ChildAdded:connect(OnChildAdded) --NOTE: Added for Action Button
-
false
Boom
1
false
rbxasset://sounds/collide.wav
1
-
true
Swoosh
1
false
http://www.roblox.com/Asset?ID=98318391
1
-
true
Rocket
-----------------
--| Constants |--
-----------------
local BLAST_RADIUS = 6
local BLAST_PRESSURE = 750000
-- Rocket will fly through things named these
local ROCKET_IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} --NOTE: Keys must be lowercase, values must evaluate to true
--------------------
--| WaitForChild |--
--------------------
-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
-----------------
--| Variables |--
-----------------
local DebrisService = Game:GetService('Debris')
local Rocket = script.Parent
local CreatorTag = WaitForChild(Rocket, 'creator')
local Connection = nil
-----------------
--| Functions |--
-----------------
-- Returns the ancestor that contains a Humanoid, if it exists
local function FindCharacterAncestor(subject)
if subject and subject ~= Workspace then
local humanoid = subject:FindFirstChild('Humanoid')
if humanoid then
return subject, humanoid
else
return FindCharacterAncestor(subject.Parent)
end
end
return nil
end
local hitHuman=false
local function OnExplosionHit(hitPart)
if hitPart then
local _, humanoid = FindCharacterAncestor(hitPart.Parent)
if humanoid and humanoid.Health > 0 then
if CreatorTag.Value.Character:FindFirstChild('Carnagecopia') then
local tkills= CreatorTag.Value.Character:FindFirstChild('Carnagecopia'):FindFirstChild('Kills')
if tkills and not hitHuman then
tkills.Value=tkills.Value+1
hitHuman=true
end
end
end
end
end
local function OnTouched(otherPart)
if Rocket and otherPart then
-- Fly through anything in the ignore list
if ROCKET_IGNORE_LIST[string.lower(otherPart.Name)] then
return
end
-- Fly through the creator
local myPlayer = CreatorTag.Value
if myPlayer and myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
return
end
-- Create the explosion
local explosion = Instance.new('Explosion')
explosion.BlastPressure = BLAST_PRESSURE
explosion.BlastRadius = BLAST_RADIUS
explosion.Position = Rocket.Position
explosion.Hit:connect(OnExplosionHit)
explosion.Parent = Workspace
-- Start playing the boom sound
local boomSound = Rocket:FindFirstChild('Boom')
if boomSound then
boomSound:Play()
end
-- NOTE:
-- If we just destroyed the rocket at this point, the boom sound would be destroyed too,
-- so instead we will hide the rocket, keep it in the same spot, and schedule it for deletion
-- Stop playing the swoosh sound
local swooshSound = Rocket:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Stop()
end
-- Put out the fire
local fire = Rocket:FindFirstChild('Fire')
if fire then
fire:Destroy()
end
Rocket.Transparency = 1
Rocket.CanCollide = false
Rocket.Anchored = true
DebrisService:AddItem(Rocket, 3)
-- Destroy the connection so this method won't be called again
Connection:disconnect()
end
end
--------------------
--| Script Logic |--
--------------------
-- Arm the rocket and save the touch connection so we can disconnect it later
Connection = Rocket.Touched:connect(OnTouched)
-
RocketMeshes
6
-
2
2
http://www.roblox.com/asset/?id=16190555
5
1
0
0
0
1.60000002
1.60000002
1.60000002
http://www.roblox.com/asset/?id=16190577
1
1
1
-
2
2
http://www.roblox.com/asset/?id=28937301
5
2
0
0
0
1
1
1
http://www.roblox.com/asset/?id=28937670
1
1
1
-
2
2
http://www.roblox.com/asset/?id=13073626
5
3
0
0
0
1.5
1.5
1.5
http://www.roblox.com/asset/?id=13073598
1
1
1
-
2
2
http://www.roblox.com/asset/?id=40311092
5
4
0
0
0
1
1
1
http://www.roblox.com/asset/?id=40311049
0.699999988
0.699999988
0.699999988
-
2
2
http://www.roblox.com/asset/?id=16215477
5
5
0
0
0
1.04999995
1.04999995
1.04999995
http://www.roblox.com/asset/?id=16215451
1
1
1
-
2
2
http://www.roblox.com/asset/?id=16940906
5
6
0
0
0
0.800000012
0.800000012
0.800000012
http://www.roblox.com/asset/?id=16940893
1
1
1
-
textGui
-
false
4288914085
1
4279970357
1
false
false
Frame
0.25
0
0.75
0
0.5
0
0.100000001
0
0
0
true
1
-
false
ElementShaker
local Element = script.Parent
local ShakeSpeed = .05
local ShakeAmount = 5
local StartPosition=Element.Position
while true do
local angle= math.random()*math.pi*2
Element:TweenPosition(StartPosition+UDim2.new(0,math.cos(angle)*ShakeAmount,0,math.sin(angle)*ShakeAmount), "Out", "Quad", ShakeSpeed, true)
wait(ShakeSpeed+.01)
end
-
false
4288914085
1
4279970357
1
false
false
http://www.roblox.com/asset/?id=98341554
ImageLabel
0
0
0
0
1
0
1
0
0
true
1
-
false
4288914085
1
4279970357
1
false
false
Frame
0.25
0
0.75
0
0.5
0
0.100000001
0
0
0
true
1
-
false
ElementShaker
local Element = script.Parent
local ShakeSpeed = .05
local ShakeAmount = 5
local StartPosition=Element.Position
while true do
local angle= math.random()*math.pi*2
Element:TweenPosition(StartPosition+UDim2.new(0,math.cos(angle)*ShakeAmount,0,math.sin(angle)*ShakeAmount), "Out", "Quad", ShakeSpeed, true)
wait(ShakeSpeed+.01)
end
-
false
4288914085
1
4279970357
1
false
false
http://www.roblox.com/asset/?id=98341065
ImageLabel
0
0
0
0
1
0
1
0
0
true
1
-
Kills
0
-
[null]
0
21.965271
78.1268539
-47.4067459
-0.631106079
-0.0419355072
-0.77456218
-3.7252903e-009
0.9985376
-0.0540617406
0.775696516
-0.0341186896
-0.63018316
70
24.4460411
78.3000031
-45.3883934
1
0
0
0
1
0
0
0
1
ThumbnailCamera