Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Made by Miniix15
- --Converted with PenguinAnonymous'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")
- Animation1 = Instance.new("Animation")
- Animation2 = Instance.new("Animation")
- Animation3 = Instance.new("Animation")
- Animation4 = Instance.new("Animation")
- Animation5 = Instance.new("Animation")
- Part6 = Instance.new("Part")
- Sound7 = Instance.new("Sound")
- Sound8 = Instance.new("Sound")
- Sound9 = Instance.new("Sound")
- SpecialMesh10 = Instance.new("SpecialMesh")
- ParticleEmitter11 = Instance.new("ParticleEmitter")
- ParticleEmitter12 = Instance.new("ParticleEmitter")
- LocalScript13 = Instance.new("LocalScript")
- LocalScript14 = Instance.new("LocalScript")
- LocalScript15 = Instance.new("LocalScript")
- Script16 = Instance.new("Script")
- Script17 = Instance.new("Script")
- Script18 = Instance.new("Script")
- BoolValue19 = Instance.new("BoolValue")
- BoolValue20 = Instance.new("BoolValue")
- BoolValue21 = Instance.new("BoolValue")
- BoolValue22 = Instance.new("BoolValue")
- Tool0.Name = "Real Knife"
- Tool0.Parent = mas
- Tool0.GripPos = Vector3.new(0, -1, -0.100000001)
- Animation1.Name = "ThrowCharge"
- Animation1.Parent = Tool0
- Animation1.AnimationId = "http://www.roblox.com/Asset?ID=93103762"
- Animation2.Name = "Throw"
- Animation2.Parent = Tool0
- Animation2.AnimationId = "http://www.roblox.com/Asset?ID=89147993"
- Animation3.Name = "StabPunch"
- Animation3.Parent = Tool0
- Animation3.AnimationId = "http://www.roblox.com/Asset?ID=89134792"
- Animation4.Name = "KnifeIdle"
- Animation4.Parent = Tool0
- Animation5.Name = "DownStab"
- Animation5.Parent = Tool0
- Animation5.AnimationId = "http://www.roblox.com/Asset?ID=89133529"
- Part6.Name = "Handle"
- Part6.Parent = Tool0
- Part6.Material = Enum.Material.DiamondPlate
- Part6.BrickColor = BrickColor.new("Really black")
- Part6.Reflectance = 0.0099999997764826
- Part6.Rotation = Vector3.new(-180, 0, -180)
- Part6.Elasticity = 0
- Part6.FormFactor = Enum.FormFactor.Custom
- Part6.Size = Vector3.new(0.400000006, 3, 0.699999988)
- Part6.CFrame = CFrame.new(-6, 1.50003195, -12, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part6.BottomSurface = Enum.SurfaceType.Smooth
- Part6.TopSurface = Enum.SurfaceType.Smooth
- Part6.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part6.Position = Vector3.new(-6, 1.50003195, -12)
- Part6.Orientation = Vector3.new(0, 180, 0)
- Part6.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Sound7.Name = "Swoosh"
- Sound7.Parent = Part6
- Sound7.SoundId = "http://www.roblox.com/asset?id=153647529"
- Sound7.Volume = 1
- Sound7.PlayOnRemove = true
- Sound8.Name = "Swoosh1"
- Sound8.Parent = Part6
- Sound8.SoundId = "rbxassetid://1072555790"
- Sound8.Volume = 1
- Sound8.PlayOnRemove = true
- Sound9.Name = "Ting"
- Sound9.Parent = Part6
- Sound9.SoundId = "http://www.roblox.com/asset?id=153647529"
- Sound9.Volume = 0.20000000298023
- SpecialMesh10.Parent = Part6
- SpecialMesh10.MeshId = "http://www.roblox.com/asset/?id=121944778 "
- SpecialMesh10.TextureId = "rbxassetid://362719969"
- SpecialMesh10.MeshType = Enum.MeshType.FileMesh
- ParticleEmitter11.Name = "Light Particles"
- ParticleEmitter11.Parent = Part6
- ParticleEmitter11.Transparency = NumberSequence.new(0.69999998807907,0.69999998807907)
- ParticleEmitter11.Size = NumberSequence.new(0.20000000298023,0.20000000298023)
- ParticleEmitter11.LightEmission = 1
- ParticleEmitter11.Texture = "http://www.roblox.com/asset/?id=162595515"
- ParticleEmitter11.Lifetime = NumberRange.new(0.30000001192093, 0.30000001192093)
- ParticleEmitter11.Rate = 9999
- ParticleEmitter11.RotSpeed = NumberRange.new(99999, 99999)
- ParticleEmitter11.VelocitySpread = 99
- ParticleEmitter12.Name = "Hit Particles"
- ParticleEmitter12.Parent = Part6
- ParticleEmitter12.Transparency = NumberSequence.new(0.69999998807907,0.69999998807907)
- ParticleEmitter12.Size = NumberSequence.new(0.40000000596046,0.40000000596046)
- ParticleEmitter12.Color = ColorSequence.new(Color3.new(1, 0, 0.0352941),Color3.new(1, 0, 0.0352941))
- ParticleEmitter12.LightEmission = 0.5
- ParticleEmitter12.Texture = "http://www.roblox.com/asset/?id=141116476"
- ParticleEmitter12.Lifetime = NumberRange.new(0.20000000298023, 0.20000000298023)
- ParticleEmitter12.Rate = inf
- ParticleEmitter12.Speed = NumberRange.new(1, 1)
- ParticleEmitter12.Color = ColorSequence.new(Color3.new(1, 0, 0.0352941),Color3.new(1, 0, 0.0352941))
- LocalScript13.Name = "KnifeScript"
- LocalScript13.Parent = Tool0
- table.insert(cors,sandbox(LocalScript13,function()
- --------------------- TEMPLATE BLADE WEAPON ---------------------------
- -- Waits for the child of the specified parent
- local function WaitForChild(parent, childName)
- while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
- return parent[childName]
- end
- local SLASH_DAMAGE = 999
- local DOWNSTAB_DAMAGE = 999
- local THROWING_DAMAGE = 999
- local HOLD_TO_THROW_TIME = 0.30
- local Damage = 999
- local MyHumanoid = nil
- local MyTorso = nil
- local MyCharacter = nil
- local MyPlayer = nil
- local Tool = script.Parent
- local Handle = WaitForChild(Tool, 'Handle')
- local BlowConnection
- local Button1DownConnection
- local Button1UpConnection
- local PlayStabPunch
- local PlayDownStab
- local PlayThrow
- local PlayThrowCharge
- local IconUrl = Tool.TextureId -- URL to the weapon knife icon asset
- local DebrisService = game:GetService('Debris')
- local PlayersService = game:GetService('Players')
- local SlashSound
- local HitPlayers = {}
- local LeftButtonDownTime = nil
- local Attacking = false
- function Blow(hit)
- if Attacking then
- BlowDamage(hit, Damage)
- end
- end
- function BlowDamage(hit, damage)
- local humanoid = hit.Parent:FindFirstChild('Humanoid')
- local player = PlayersService:GetPlayerFromCharacter(hit.Parent)
- if humanoid ~= nil and MyHumanoid ~= nil and humanoid ~= MyHumanoid then
- if not MyPlayer.Neutral then
- -- Ignore teammates hit
- if player and player ~= MyPlayer and player.TeamColor == MyPlayer.TeamColor then
- return
- end
- end
- -- final check, make sure weapon is in-hand
- local rightArm = MyCharacter:FindFirstChild('Right Arm')
- if (rightArm ~= nil) then
- -- Check if the weld exists between the hand and the weapon
- local joint = rightArm:FindFirstChild('RightGrip')
- if (joint ~= nil and (joint.Part0 == Handle or joint.Part1 == Handle)) then
- -- Make sure you only hit them once per swing
- TagHumanoid(humanoid, MyPlayer)
- print("Sending " .. damage)
- local checksound = humanoid.Parent:findFirstChild("Sound")
- if checksound == nil then
- local givesound = script.Parent.Sound:clone()
- givesound.Parent = humanoid.Parent
- givesound.Disabled = false
- else
- checksound:remove()
- local givesound = script.Parent.Sound:clone()
- givesound.Parent = humanoid.Parent
- givesound.Disabled = false
- end
- wait()
- humanoid:TakeDamage(humanoid.MaxHealth)
- if humanoid.Health == math.huge or humanoid.MaxHealth == math.huge then
- humanoid.Parent:BreakJoints()
- end
- end
- end
- end
- end
- function TagHumanoid(humanoid, player)
- -- Add more tags here to customize what tags are available.
- while humanoid:FindFirstChild('creator') do
- humanoid:FindFirstChild('creator'):Destroy()
- end
- local creatorTag = Instance.new('ObjectValue')
- creatorTag.Value = player
- creatorTag.Name = 'creator'
- creatorTag.Parent = humanoid
- DebrisService:AddItem(creatorTag, 1.5)
- local weaponIconTag = Instance.new('StringValue')
- weaponIconTag.Value = IconUrl
- weaponIconTag.Name = 'icon'
- weaponIconTag.Parent = creatorTag
- DebrisService:AddItem(weaponIconTag, 1.5)
- end
- function HardAttack()
- Damage = SLASH_DAMAGE
- HitSound:play()
- if PlayStabPunch then
- PlayStabPunch.Value = true
- wait(1.0)
- PlayStabPunch.Value = false
- end
- end
- function NormalAttack()
- Damage = DOWNSTAB_DAMAGE
- KnifeDown()
- HitSound:play()
- if PlayDownStab then
- PlayDownStab.Value = true
- wait(1.0)
- PlayDownStab.Value = false
- end
- KnifeUp()
- end
- function ThrowAttack()
- KnifeOut()
- if PlayThrow then
- PlayThrow.Value = true
- wait()
- if not Handle then return end
- local throwingHandle = Handle:Clone()
- DebrisService:AddItem(throwingHandle, 5)
- throwingHandle.Parent = game.Workspace
- if MyCharacter and MyHumanoid then
- throwingHandle.Velocity = (MyHumanoid.TargetPoint - throwingHandle.CFrame.p).unit * 100
- -- set the orientation to the direction it is being thrown in
- throwingHandle.CFrame = CFrame.new(throwingHandle.CFrame.p, throwingHandle.CFrame.p + throwingHandle.Velocity) * CFrame.Angles(0, 0, math.rad(-90))
- local floatingForce = Instance.new('BodyForce', throwingHandle)
- floatingForce.force = Vector3.new(0, 196.2 * throwingHandle:GetMass() * 0.98, 0)
- local spin = Instance.new('BodyAngularVelocity', throwingHandle)
- spin.angularvelocity = throwingHandle.CFrame:vectorToWorldSpace(Vector3.new(0, -400, 0))
- end
- Handle.Transparency = 1
- -- Wait so that the knife has left the thrower's general area
- wait()
- if throwingHandle then
- local Throwevent = script.Parent.ThrowHandleHitWeld:Clone()
- Throwevent.Parent = throwingHandle
- Throwevent.Disabled = false
- local touchedConn = throwingHandle.Touched:connect(function(hit) print("hit throw") BlowDamage(hit, THROWING_DAMAGE) end)
- end
- -- must check if it still exists since we waited
- if throwingHandle then
- throwingHandle.CanCollide = true
- end
- wait(0.6)
- if Handle and PlayThrow then
- Handle.Transparency = 0
- PlayThrow.Value = false
- end
- end
- KnifeUp()
- end
- function KnifeUp()
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(1,0,0)
- Tool.GripUp = Vector3.new(0,1,0)
- end
- function KnifeDown()
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(1,0,0)
- Tool.GripUp = Vector3.new(0,-1,0)
- end
- function KnifeOut()
- Tool.GripForward = Vector3.new(0,0,-1)
- Tool.GripRight = Vector3.new(1,0,0)
- Tool.GripUp = Vector3.new(0,1,0)
- end
- Tool.Enabled = true
- function OnLeftButtonDown()
- LeftButtonDownTime = time()
- if PlayThrowCharge then
- PlayThrowCharge.Value = true
- end
- end
- function OnLeftButtonUp()
- if not Tool.Enabled then return end
- -- Reset the list of hit players every time we start a new attack
- HitPlayers = {}
- if PlayThrowCharge then
- PlayThrowCharge.Value = false
- end
- if Tool.Enabled and MyHumanoid and MyHumanoid.Health > 0 then
- Tool.Enabled = false
- local currTime = time()
- if LeftButtonDownTime and currTime - LeftButtonDownTime > HOLD_TO_THROW_TIME and
- currTime - LeftButtonDownTime < 1.15 then
- ThrowAttack()
- else
- Attacking = true
- if math.random(1, 2) == 1 then
- HardAttack()
- else
- NormalAttack()
- end
- Attacking = false
- end
- Tool.Enabled = true
- end
- end
- function OnEquipped(mouse)
- PlayStabPunch = WaitForChild(Tool, 'PlayStabPunch')
- PlayDownStab = WaitForChild(Tool, 'PlayDownStab')
- PlayThrow = WaitForChild(Tool, 'PlayThrow')
- PlayThrowCharge = WaitForChild(Tool, 'PlayThrowCharge')
- SlashSound = WaitForChild(Handle, 'Swoosh1')
- HitSound = WaitForChild(Handle, 'Ting')
- SlashSound:play()
- BlowConnection = Handle.Touched:connect(Blow)
- MyCharacter = Tool.Parent
- MyTorso = MyCharacter:FindFirstChild('Torso')
- MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
- MyPlayer = PlayersService.LocalPlayer
- if mouse then
- Button1DownConnection = mouse.Button1Down:connect(OnLeftButtonDown)
- Button1UpConnection = mouse.Button1Up:connect(OnLeftButtonUp)
- end
- KnifeUp()
- end
- function OnUnequipped()
- -- Unequip logic here
- if BlowConnection then
- BlowConnection:disconnect()
- BlowConnection = nil
- end
- if Button1DownConnection then
- Button1DownConnection:disconnect()
- Button1DownConnection = nil
- end
- if Button1UpConnection then
- Button1UpConnection:disconnect()
- Button1UpConnection = nil
- end
- MyHumanoid = nil
- end
- Tool.Equipped:connect(OnEquipped)
- Tool.Unequipped:connect(OnUnequipped)
- end))
- LocalScript14.Name = "BladeGui"
- LocalScript14.Parent = Tool0
- table.insert(cors,sandbox(LocalScript14,function()
- local Tool = script.Parent
- function OnButton1Down(mouse)
- if Tool.Enabled then
- mouse.Icon = 'http://www.roblox.com/asset/?id=54019936'
- else
- mouse.Icon = 'http://www.roblox.com/asset/?id=54019936'
- end
- while not Tool.Enabled do
- Tool.Changed:wait()
- end
- if Tool.Enabled then
- mouse.Icon = 'http://www.roblox.com/asset/?id=54019936'
- end
- end
- function OnEquipped(mouse)
- if mouse == nil then
- print("Mouse not found")
- return
- end
- mouse.Icon = 'http://www.roblox.com/asset/?id=54019936'
- mouse.Button1Down:connect(function() OnButton1Down(mouse) end)
- end
- Tool.Equipped:connect(OnEquipped)
- end))
- LocalScript15.Name = "AnimationScript"
- LocalScript15.Parent = Tool0
- table.insert(cors,sandbox(LocalScript15,function()
- -- Waits for the child of the specified parent
- local function WaitForChild(parent, childName)
- while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
- return parent[childName]
- end
- local Tool = script.Parent
- local downStabAnim
- local stabPunchAnim
- local throwAnim
- local throwChargeAnim
- local MyHumanoid
- -- This table will make sure that when we stop an animation it is
- -- because it is the only animation of it running
- local PlayCountTable = {}
- local function PlayAnimation(animation, valueToCheck, animationLength)
- if valueToCheck and valueToCheck.Value then
- if MyHumanoid then
- animation:Play()
- if PlayCountTable[animation] then
- PlayCountTable[animation] = PlayCountTable[animation] + 1
- end
- -- wait the duration of the animation
- if animationLength then
- wait(animationLength)
- if PlayCountTable[animation] then
- PlayCountTable[animation] = PlayCountTable[animation] - 1
- if PlayCountTable[animation] == 0 then
- animation:Stop()
- end
- end
- end
- end
- end
- end
- function OnEquipped()
- MyHumanoid = Tool.Parent:FindFirstChild('Humanoid')
- downStabAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'DownStab'))
- PlayCountTable[downStabAnim] = 0
- stabPunchAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'StabPunch'))
- PlayCountTable[stabPunchAnim] = 0
- throwAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'Throw'))
- PlayCountTable[throwAnim] = 0
- throwChargeAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrowCharge'))
- PlayCountTable[throwChargeAnim] = 0
- local playStabPunch = WaitForChild(Tool, 'PlayStabPunch')
- local playDownStab = WaitForChild(Tool, 'PlayDownStab')
- local playThrow = WaitForChild(Tool, 'PlayThrow')
- local playThrowCharge = WaitForChild(Tool, 'PlayThrowCharge')
- playStabPunch.Changed:connect(function() PlayAnimation(stabPunchAnim, playStabPunch, 1.0) end)
- playDownStab.Changed:connect(function() PlayAnimation(downStabAnim, playDownStab, 1.0) end)
- playThrow.Changed:connect(function() PlayAnimation(throwAnim, playThrow, 1.5) end)
- playThrowCharge.Changed:connect(function(value)
- if value then
- PlayAnimation(throwChargeAnim, playThrowCharge, 1.0)
- else
- throwChargeAnim:Stop()
- end
- end)
- end
- function OnUnequipped()
- if downStabAnim then
- downStabAnim:Stop()
- downStabAnim = nil
- end
- if stabPunchAnim then
- stabPunchAnim:Stop()
- stabPunchAnim = nil
- end
- if throwAnim then
- throwAnim:Stop()
- throwAnim = nil
- end
- if throwChargeAnim then
- throwChargeAnim:Stop()
- throwChargeAnim = nil
- end
- PlayCountTable = {}
- end
- Tool.Equipped:connect(OnEquipped)
- Tool.Unequipped:connect(OnUnequipped)
- end))
- Script16.Name = "ThrowHandleHitWeld"
- Script16.Parent = Tool0
- Script16.Disabled = true
- table.insert(cors,sandbox(Script16,function()
- arrow = script.Parent
- local HitSound = Instance.new("Sound")
- HitSound.SoundId = "http://www.roblox.com/asset?id=437475935"
- HitSound.Parent = arrow
- HitSound.Volume = .5
- function stick(hit)
- local AV = arrow:findFirstChild("BodyForce")
- local FO = arrow:findFirstChild("BodyAngularVelocity")
- if AV ~= nil then AV:remove() end
- if FO ~= nil then FO:remove() end
- -- joint myself to the thing i hit
- local weld = Instance.new("Weld")
- weld.Name = "PieWeld"
- weld.Part0 = arrow
- weld.Part1 = hit
- local backupweld = Instance.new("Weld")
- backupweld.Name = "PieWeldBackup"
- backupweld.Part0 = arrow
- backupweld.Part1 = hit
- -- correction term to account for average skew between physics update and heartbeat
- local HitPos = arrow.Position --+ (-arrow.Velocity * (1/60)) --+ (arrow.CFrame.lookVector * .5)
- local CJ = CFrame.new(HitPos)
- local C0 = arrow.CFrame:inverse() *CJ
- local C1 = hit.CFrame:inverse() * CJ
- weld.C0 = C0
- weld.C1 = C1
- weld.Parent = arrow
- backupweld.C0 = C0
- backupweld.C1 = C1
- backupweld.Parent = arrow
- end
- function onTouched(hit)
- connection:disconnect()
- stick(hit)
- HitSound:Play()
- end
- connection = arrow.Touched:connect(onTouched)
- wait(2)
- if (arrow:FindFirstChild("PieWeld") ~= nil) then
- arrow.PieWeld:Remove()
- end
- wait(8)
- arrow.Parent = nil
- end))
- Script17.Name = "SoundScript"
- Script17.Parent = Tool0
- table.insert(cors,sandbox(Script17,function()
- -- Waits for the child of the specified parent
- local function WaitForChild(parent, childName)
- while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
- return parent[childName]
- end
- local Tool = script.Parent
- local Handle = WaitForChild(Tool, 'Handle')
- local Debounce = false
- local TouchConnection
- function OnTouched(hit)
- local humanoid = hit.Parent:findFirstChild('Humanoid')
- if Debounce == false then
- Debounce = true
- if humanoid then
- else
- Handle.Ting:Play()
- end
- end
- wait(0.5)
- Debounce = false
- end
- Tool.Equipped:connect(function()
- TouchConnection = Handle.Touched:connect(OnTouched)
- end)
- Tool.Unequipped:connect(function()
- if TouchConnection then
- TouchConnection:disconnect()
- TouchConnection = nil
- end
- end)
- end))
- Script18.Name = "Sound"
- Script18.Parent = Tool0
- Script18.Disabled = true
- table.insert(cors,sandbox(Script18,function()
- -- For knife
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end
- function newSound(id)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.archivable = false
- sound.Parent = script.Parent.Head
- return sound
- end
- -- declarations
- local sDied = newSound("http://www.roblox.com/asset?id=1072559190")
- local sFallingDown = newSound("rbxasset://sounds/splat.wav")
- local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
- local sGettingUp = newSound("rbxasset://sounds/hit.wav")
- local sJumping = newSound("rbxasset://sounds/button.wav")
- local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
- sRunning.Looped = true
- local Figure = script.Parent
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- -- functions
- function onDied()
- sDied:Play()
- end
- function onState(state, sound)
- if state then
- sound:Play()
- else
- sound:Pause()
- end
- end
- function onRunning(speed)
- if speed>0.01 then
- sRunning:Play()
- else
- sRunning:Pause()
- end
- end
- -- connect up
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
- Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
- Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
- Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
- end))
- BoolValue19.Name = "PlayThrowCharge"
- BoolValue19.Parent = Tool0
- BoolValue20.Name = "PlayThrow"
- BoolValue20.Parent = Tool0
- BoolValue21.Name = "PlayStabPunch"
- BoolValue21.Parent = Tool0
- BoolValue22.Name = "PlayDownStab"
- BoolValue22.Parent = Tool0
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Character
- 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