Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- Sound2 = Instance.new("Sound")
- Decal3 = Instance.new("Decal")
- Decal4 = Instance.new("Decal")
- Decal5 = Instance.new("Decal")
- Decal6 = Instance.new("Decal")
- Decal7 = Instance.new("Decal")
- Decal8 = Instance.new("Decal")
- Script9 = Instance.new("Script")
- Script10 = Instance.new("Script")
- NumberValue11 = Instance.new("NumberValue")
- NumberValue12 = Instance.new("NumberValue")
- LocalScript13 = Instance.new("LocalScript")
- LocalScript14 = Instance.new("LocalScript")
- LocalScript15 = Instance.new("LocalScript")
- LocalScript16 = Instance.new("LocalScript")
- Tool0.Name = "C4"
- Tool0.Parent = mas
- Tool0.GripForward = Vector3.new(-0.999949992, 0.00999949966, -0)
- Tool0.GripRight = Vector3.new(0, 0, -1)
- Tool0.GripUp = Vector3.new(0.00999949966, 0.999949992, 0)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Bright yellow")
- Part1.Rotation = Vector3.new(0, 0, -180)
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(2, 1, 2)
- Part1.CFrame = CFrame.new(-8.00000286, 0.5, 32, -1, 8.81815954e-09, 2.77323443e-06, -8.81815598e-09, -1, 9.62744329e-10, 2.77323443e-06, 9.62719904e-10, 1)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part1.Position = Vector3.new(-8.00000286, 0.5, 32)
- Part1.Orientation = Vector3.new(0, 0, -180)
- Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Sound2.Name = "SlingshotSound"
- Sound2.Parent = Part1
- Sound2.SoundId = "rbxasset://sounds//Rubber band sling shot.wav"
- Sound2.Volume = 1
- Decal3.Parent = Part1
- Decal3.Texture = "http://www.roblox.com/asset/?id=6005835"
- Decal3.Face = Enum.NormalId.Bottom
- Decal4.Parent = Part1
- Decal4.Texture = "http://www.roblox.com/asset/?id=6005846"
- Decal4.Face = Enum.NormalId.Right
- Decal5.Parent = Part1
- Decal5.Texture = "http://www.roblox.com/asset/?id=6005846"
- Decal5.Face = Enum.NormalId.Back
- Decal6.Parent = Part1
- Decal6.Texture = "http://www.roblox.com/asset/?id=6005846"
- Decal6.Face = Enum.NormalId.Left
- Decal7.Parent = Part1
- Decal7.Texture = "http://www.roblox.com/asset/?id=6005846"
- Decal8.Parent = Part1
- Decal8.Texture = "http://www.roblox.com/asset/?id=6005835"
- Decal8.Face = Enum.NormalId.Top
- Script9.Name = "Slingshot"
- Script9.Parent = Tool0
- table.insert(cors,sandbox(Script9,function()
- Tool = script.Parent
- VELOCITY = 25 -- constant
- local Pellet = script.Parent.Handle:clone()
- Pellet.Locked = true
- Pellet.BackSurface = 0
- Pellet.BottomSurface = 0
- Pellet.FrontSurface = 0
- Pellet.LeftSurface = 0
- Pellet.RightSurface = 0
- Pellet.TopSurface = 0
- Pellet.SlingshotSound:remove()
- script.Parent.Bomb:clone().Parent = Pellet
- function fire(mouse_pos)
- Tool.Handle.SlingshotSound:play()
- -- find player's head pos
- local vCharacter = Tool.Parent
- local vPlayer = game.Players:playerFromCharacter(vCharacter)
- local head = vCharacter:findFirstChild("Head")
- if head == nil then return end
- local dir = mouse_pos - head.Position
- dir = computeDirection(dir)
- local launch = head.Position + 5 * 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
- local missile = Pellet:clone()
- missile.Position = launch
- missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
- missile.Bomb.Disabled = false
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = vPlayer
- creator_tag.Name = "creator"
- creator_tag.Parent = missile
- missile.Parent = game.Workspace
- script.Parent.BombOut.Value = 1
- end
- function computeLaunchAngle(dx,dy,grav)
- -- arcane
- -- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
- local g = math.abs(grav)
- local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
- if inRoot <= 0 then
- return .25 * math.pi
- end
- local root = math.sqrt(inRoot)
- local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
- local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
- local answer1 = math.atan(inATan1)
- local answer2 = math.atan(inATan2)
- if answer1 < answer2 then return answer1 end
- return answer2
- end
- function computeDirection(vec)
- local lenSquared = vec.magnitude * vec.magnitude
- local invSqrt = 1 / math.sqrt(lenSquared)
- return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
- end
- Tool.Enabled = true
- function onActivated()
- if not Tool.Enabled or script.Parent.BombOut.Value == 1 then
- return
- end
- Pellet.Name = ""..script.Parent.Parent.Name.." Bomb"
- Tool.Enabled = false
- local character = Tool.Parent;
- local humanoid = character.Humanoid
- if humanoid == nil then
- print("Humanoid not found")
- return
- end
- local targetPos = humanoid.TargetPoint
- fire(targetPos)
- wait(.2)
- Tool.Enabled = true
- end
- script.Parent.Activated:connect(onActivated)
- end))
- Script10.Name = "Bomb"
- Script10.Parent = Tool0
- Script10.Disabled = true
- table.insert(cors,sandbox(Script10,function()
- updateInterval = 0.4
- currentColor = 1
- colors = {26, 21}
- function onTouched(hit)
- local weld = Instance.new("Weld")
- weld.Part0 = script.Parent
- weld.Part1 = hit
- local temp = CFrame.new((script.Parent.Position + hit.Position) * 0.5)
- weld.C0 = script.Parent.CFrame:inverse() * temp
- weld.C1 = hit.CFrame:inverse() * temp
- weld.Parent = script.Parent
- connection:disconnect()
- Remove()
- end
- function Remove()
- wait(10)
- if script.Parent.Parent ~= nil then
- script.Parent.Parent = nil
- elseif script.Parent.Parent == nil then
- return
- end
- end
- connection = script.Parent.Touched:connect(onTouched)
- end))
- NumberValue11.Name = "BombOut"
- NumberValue11.Parent = Tool0
- NumberValue12.Name = "Tutorialized"
- NumberValue12.Parent = Tool0
- NumberValue12.Value = 14
- LocalScript13.Parent = Tool0
- table.insert(cors,sandbox(LocalScript13,function()
- local Tool = script.Parent;
- local check = script.Parent.BombOut
- local db = script.Parent.Tutorialized
- function onKeyDown(key)
- if (key~=nil) then
- key = key:lower()
- if (key=="q") then
- if script.Parent.BombOut.Value == 1 then
- local bomb = game.Workspace:FindFirstChild(""..script.Parent.Parent.Name.." Bomb")
- if bomb ~= nil then
- blowUp(bomb)
- bomb.Transparency = 1
- local decal = bomb:GetChildren()
- for i=1, #decal do
- if decal[i].className == "Decal" then
- decal[i]:remove()
- end
- end
- end
- wait(3)
- script.Parent.BombOut.Value = 0
- bomb:remove()
- end
- end
- end
- if (key=="e") then
- local clean = game.Workspace:GetChildren()
- for i=1, #clean do
- if clean[i].Name == ""..script.Parent.Parent.Name.." Bomb" then
- clean[i]:remove()
- end
- end
- script.Parent.BombOut.Value = 0
- end
- end
- enabled = true
- function onButton1Down(mouse)
- if not enabled then
- return
- end
- enabled = false
- wait(3)
- enabled = true
- end
- function onEquippedLocal(mouse)
- if mouse == nil then
- print("Mouse not found")
- return
- end
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- mouse.KeyDown:connect(onKeyDown)
- if db.Value == 0 then
- db.Value = 14
- local message = Instance.new("Hint")
- message.Parent = game.Players:findFirstChild(script.Parent.Parent.Name)
- message.Text = "Thanks for using C4 by Malvaviscos"
- wait(3)
- message.Text = "Click to drop C4 (Fires like a slingshot)"
- wait(3)
- message.Text = "Press 'q' to detonate the C4, and 'e' to remove it."
- wait(3)
- message.Text = "If the tool stops working, press 'e' also to reset it."
- wait(3)
- message:remove()
- end
- end
- function blowUp(obj)
- local sound = Instance.new("Sound")
- sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
- sound.Parent = obj
- sound.Volume = 1
- sound:play()
- explosion = Instance.new("Explosion")
- explosion.BlastRadius = 15
- explosion.BlastPressure = 100 -- these are really wussy units
- -- find instigator tag
- local creator = script.Parent:findFirstChild("creator")
- if creator ~= nil then
- explosion.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end)
- end
- explosion.Position = obj.Position
- explosion.Parent = game.Workspace
- end
- function onPlayerBlownUp(part, distance, creator)
- if part.Name == "Head" then
- local humanoid = part.Parent.Humanoid
- tagHumanoid(humanoid, creator)
- end
- end
- function tagHumanoid(humanoid, creator)
- -- tag does not need to expire iff all explosions lethal
- if creator ~= nil then
- local new_tag = creator:clone()
- new_tag.Parent = humanoid
- end
- end
- function untagHumanoid(humanoid)
- if humanoid ~= nil then
- local tag = humanoid:findFirstChild("creator")
- if tag ~= nil then
- tag.Parent = nil
- end
- end
- end
- Tool.Equipped:connect(onEquippedLocal)
- end))
- LocalScript14.Name = "Local Gui"
- LocalScript14.Parent = Tool0
- table.insert(cors,sandbox(LocalScript14,function()
- local Tool = script.Parent;
- enabled = true
- function onButton1Down(mouse)
- if not enabled then
- return
- end
- enabled = false
- wait(2)
- enabled = true
- end
- function onEquippedLocal(mouse)
- if mouse == nil then
- print("Mouse not found")
- return
- end
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- end
- Tool.Equipped:connect(onEquippedLocal)
- end))
- LocalScript15.Name = "IFF"
- LocalScript15.Parent = Tool0
- table.insert(cors,sandbox(LocalScript15,function()
- --hey. it's me alextomcool. just change the normel, friendly and enemy crosshair's or just use the starter crosshair's.
- --this was modifed from a KeyDoor script. credit's to whomever made the KeyDoors
- bin = script.Parent
- normel = "http://www.roblox.com/asset/?id=7419350"
- friendly = "http://www.roblox.com/asset/?id=7419364"
- enemy = "http://www.roblox.com/asset/?id=7419379"
- function Run(mouse)
- mouse.Icon = normel
- local hit = mouse.Target
- if (hit == nil) then return end
- h = hit.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- torso = hit.Parent.Torso
- if torso ~= nil then
- if h.Health > 0 then
- if (torso.BrickColor == bin.Parent.Torso.BrickColor) then
- mouse.Icon = friendly
- elseif torso.BrickColor ~= bin.Parent.Torso.BrickColor then
- mouse.Icon = enemy
- end
- end
- end
- end
- end
- function on(mouse)
- while true do
- wait()
- Run(mouse)
- end
- end
- script.Parent.Equipped:connect(on)
- end))
- LocalScript16.Name = "AmmoScript"
- LocalScript16.Parent = Tool0
- table.insert(cors,sandbox(LocalScript16,function()
- Tool = script.Parent
- function equip()
- print("Equipped")
- if game.Players.LocalPlayer ~= nil then
- local m = Instance.new("Message")
- m.Parent = game.Players.LocalPlayer
- m.Name = "AmmoStats"
- while m ~= nil do
- wait(0.1)
- m.Text = "click to place charge"
- wait(2)
- m.Text = "E to remove charge"
- wait(2)
- m.Text = "Q to detonate charge"
- wait(2)
- m.Text = "Or Press E to reset the tool"
- wait(2)
- m:remove()
- end
- end
- end
- function unequip()
- print("Unequipped")
- if game.Players.LocalPlayer ~= nil then
- print("localplayer found")
- local m = game.Players.LocalPlayer:FindFirstChild("AmmoStats")
- if m ~= nil then
- m:remove()
- end
- end
- end
- script.Parent.Equipped:connect(equip)
- script.Parent.Unequipped:connect(unequip)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement