Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = owner --game.Players.KrYn0MoRe
- local char = plr.Character
- plr.CharacterAdded:Connect(function(character)
- char = character
- make_sounds(char)
- make_shape(char)
- clear(char)
- make_joints(char)
- make_anims(char)
- give_sword()
- end)
- spawn(function()
- local pos = nil
- local torso = nil
- local tempchar = plr.Character
- if tempchar then
- torso = tempchar:FindFirstChild('Torso')
- pos = torso.CFrame
- end
- plr:LoadCharacter()
- tempchar = plr.Character
- if tempchar and pos then
- torso = tempchar:FindFirstChild('Torso')
- if torso then
- torso.CFrame = pos
- end
- end
- print("Loaded KrYn0MoRe's Old Character v1")
- end)
- function make_shape(char)
- spawn(function()
- if char then
- local CharacterMesh0 = Instance.new("CharacterMesh")
- local CharacterMesh1 = Instance.new("CharacterMesh")
- local CharacterMesh2 = Instance.new("CharacterMesh")
- local CharacterMesh3 = Instance.new("CharacterMesh")
- local CharacterMesh4 = Instance.new("CharacterMesh")
- CharacterMesh0.Name = "CL_LeftArm"
- CharacterMesh0.Parent = char
- CharacterMesh0.BodyPart = Enum.BodyPart.LeftArm
- CharacterMesh0.MeshId = 1112256772
- CharacterMesh1.Name = "CL_LeftLeg"
- CharacterMesh1.Parent = char
- CharacterMesh1.BodyPart = Enum.BodyPart.LeftLeg
- CharacterMesh1.MeshId = 1112275294
- CharacterMesh2.Name = "CL_RightArm"
- CharacterMesh2.Parent = char
- CharacterMesh2.BodyPart = Enum.BodyPart.RightArm
- CharacterMesh2.MeshId = 1112244824
- CharacterMesh3.Name = "CL_RightLeg"
- CharacterMesh3.Parent = char
- CharacterMesh3.BodyPart = Enum.BodyPart.RightLeg
- CharacterMesh3.MeshId = 1112267576
- CharacterMesh4.Name = "CL_Torso"
- CharacterMesh4.Parent = char
- CharacterMesh4.BodyPart = Enum.BodyPart.Torso
- CharacterMesh4.MeshId = 1112228624
- end
- end)
- end
- function clear(char)
- --wait(0.1)
- for i,v in pairs(char:GetChildren()) do
- if v.Name == 'Animate' then
- v:Destroy()
- end
- if v:IsA('Humanoid') then
- for i,vv in pairs(v:GetChildren()) do
- vv:Destroy()
- end
- end
- if v.Name == 'HumanoidRootPart' then
- for i,vv in pairs(v:GetChildren()) do
- if vv:IsA('Sound') then
- vv.Archivable = true
- end
- end
- end
- if v.Name ~= 'Head' then
- for i,vv in pairs(v:GetChildren()) do
- if vv:IsA('Attachment') then
- vv:Destroy()
- end
- end
- end
- if v.Name == 'Torso' then
- for i,vv in pairs(v:GetChildren()) do
- if vv:IsA('Motor6D') then
- vv:Destroy()
- end
- end
- end
- end
- end
- function make_joints(char)
- local torso = char:FindFirstChild('Torso')
- local lleg,rleg,larm,rarm,head = char:FindFirstChild('Left Leg'),char:FindFirstChild('Right Leg'),char:FindFirstChild('Left Arm'),char:FindFirstChild('Right Arm'),char:FindFirstChild('Head')
- if torso then
- local Motor6D0 = Instance.new("Motor6D")
- local Motor6D1 = Instance.new("Motor6D")
- local Motor6D2 = Instance.new("Motor6D")
- local Motor6D3 = Instance.new("Motor6D")
- local Motor6D4 = Instance.new("Motor6D")
- Motor6D0.Name = "Left Hip"
- Motor6D0.Parent = torso
- Motor6D0.MaxVelocity = 0.1
- Motor6D0.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D0.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D0.Part0 = torso
- Motor6D0.Part1 = lleg
- Motor6D1.Name = "Left Shoulder"
- Motor6D1.Parent = torso
- Motor6D1.MaxVelocity = 0.15
- Motor6D1.C0 = CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D1.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D1.Part0 = larm
- Motor6D1.Part1 = torso
- Motor6D2.Name = "Neck"
- Motor6D2.Parent = torso
- Motor6D2.MaxVelocity = 0.1
- Motor6D2.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.Part0 = torso
- Motor6D2.Part1 = head
- Motor6D3.Name = "Right Hip"
- Motor6D3.Parent = torso
- Motor6D3.MaxVelocity = 0.1
- Motor6D3.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D3.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D3.Part0 = torso
- Motor6D3.Part1 = rleg
- Motor6D4.Name = "Right Shoulder"
- Motor6D4.Parent = torso
- Motor6D4.MaxVelocity = 0.15
- Motor6D4.C0 = CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D4.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D4.Part0 = rarm
- Motor6D4.Part1 = torso
- end
- end
- function make_sounds(char)
- spawn(function()
- -- util
- local 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
- local function newSound(id,name)
- local sound = Instance.new("Sound")
- sound.Name = name or 'Sound'
- sound.SoundId = id
- sound.Volume = 1
- sound.Parent = char['Head']
- return sound
- end
- -- declarations
- local sDied = newSound("rbxasset://sounds/uuhhh.wav",'Die') -- Die
- local sFallingDown = newSound("rbxasset://sounds/splat.wav",'Trip') -- Trip
- local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav",'Fall') -- Fall
- local sGettingUp = newSound("rbxasset://sounds/hit.wav",'GetUp') -- GetUp
- local sJumping = newSound("rbxasset://sounds/button.wav",'Jump') -- Jump
- local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3",'Walk') -- Walk
- sRunning.Looped = true
- local Figure = char
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- -- functions
- local function onDied()
- sDied:Play()
- end
- local function onState(state, sound)
- if state then
- sound:Play()
- else
- sound:Pause()
- end
- end
- local function onRunning(speed)
- if speed>0 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)
- --[[
- local 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
- local function newSound(id,p)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.archivable = false
- sound.Parent = p
- return sound
- end
- local Figure = char
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local sFallingDown = newSound("rbxasset://sounds/splat.wav",Head)
- sFallingDown.Name = "Trip"
- local sGettingUp = newSound("rbxasset://sounds/hit.wav",Head)
- sGettingUp.Name = "GetUp"
- local sDied = newSound("rbxasset://sounds/uuhhh.mp3",Head)
- sDied.Name = "Die"
- local sFreeFalling = newSound("rbxassetid://138079657",Head)
- sFreeFalling.Name = "Fall"
- local sJumping = newSound("rbxasset://sounds/swoosh.wav",Head)
- sJumping.Name = "Jump"
- local sLanding = newSound("rbxassetid://138079657",Head)
- sLanding.Name = "Land"
- local sSplash = newSound("rbxassetid://138079657",Head)
- sSplash.Name = "Splash"
- local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3",Head)
- sRunning.Name = "Walk"
- sRunning.Looped = true
- local sSwimming = newSound("rbxassetid://138079657",Head)
- sSwimming.Name = "Swim"
- sSwimming.Looped = true
- local sClimbing = newSound("rbxassetid://138079657",Head)
- sClimbing.Name = "Climb"
- sClimbing.Looped = true
- local prevState = "None"
- local function stopLoopedSounds()
- sRunning:Stop()
- sClimbing:Stop()
- sSwimming:Stop()
- end
- local function onDied()
- stopLoopedSounds()
- sDied:Play()
- end
- local fallCount = 0
- local fallSpeed = 0
- local function onStateFall(state, sound)
- fallCount = fallCount + 1
- if state then
- sound.Volume = 0
- sound:Play()
- spawn(function()
- local t = 0
- local thisFall = fallCount
- while t < 1.5 and (fallCount == thisFall) do
- local vol = math.max(t - 0.3 , 0)
- sound.Volume = vol
- wait(0.1)
- t = t + 0.1
- end
- end)
- else
- sound:Stop()
- end
- fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
- end
- local function onStateNoStop(state, sound)
- if state then
- sound:Play()
- end
- end
- local function onRunning(speed)
- sClimbing:Stop()
- sSwimming:Stop()
- if (prevState == "FreeFall" and fallSpeed > 0.1) then
- local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
- sLanding.Volume = vol
- sLanding:Play()
- fallSpeed = 0
- end
- if speed>0.5 then
- sRunning:Play()
- sRunning.Pitch = 1
- else
- sRunning:Stop()
- end
- prevState = "Run"
- end
- local function onSwimming(speed)
- if (prevState ~= "Swim" and speed > 0.1) then
- local volume = math.min(1.0, speed / 350)
- sSplash.Volume = volume
- sSplash:Play()
- prevState = "Swim"
- end
- sClimbing:Stop()
- sRunning:Stop()
- sSwimming.Pitch = 1.6
- sSwimming:Play()
- end
- local function onClimbing(speed)
- sRunning:Stop()
- sSwimming:Stop()
- if speed>0.01 then
- sClimbing:Play()
- sClimbing.Pitch = speed / 5.5
- else
- sClimbing:Stop()
- end
- prevState = "Climb"
- end
- -- connect up
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Swimming:connect(onSwimming)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
- Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
- Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
- Humanoid.FallingDown:connect(function(state) stopLoopedSounds() onStateNoStop(state, sFallingDown) prevState = "Falling" end)
- Humanoid.StateChanged:connect(function(old, new)
- if not (new.Name == "Dead" or
- new.Name == "Running" or
- new.Name == "RunningNoPhysics" or
- new.Name == "Swimming" or
- new.Name == "Jumping" or
- new.Name == "GettingUp" or
- new.Name == "Freefall" or
- new.Name == "FallingDown") then
- stopLoopedSounds()
- end
- end)
- ]]
- end)
- end
- function make_anims(char)
- spawn(function()
- local function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- spawn(function()
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end)
- end
- local Figure = char
- local Torso = waitForChild(Figure, "Torso")
- local RightShoulder = waitForChild(Torso, "Right Shoulder")
- local LeftShoulder = waitForChild(Torso, "Left Shoulder")
- local RightHip = waitForChild(Torso, "Right Hip")
- local LeftHip = waitForChild(Torso, "Left Hip")
- local Neck = waitForChild(Torso, "Neck")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local pose = "Standing"
- local Joints = Torso:GetChildren()
- for All = 1, #Joints do
- if Joints.className == "Motor" or Joints.className == "Motor6D" then
- Joints[All]:Remove()
- end
- end
- ZStat = 1
- ZStat2 = 0
- local pose = "Standing"
- RightShoulder.Part0 = Torso
- RightShoulder.Part1 = Figure["Right Arm"]
- RightShoulder.MaxVelocity = 0.15
- RightShoulder.Name = "Right Shoulder"
- RightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- RightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- RightShoulder.Parent = Torso
- LeftShoulder.Part0 = Torso
- LeftShoulder.Part1 = Figure["Left Arm"]
- LeftShoulder.MaxVelocity = 0.15
- LeftShoulder.Name = "Left Shoulder"
- LeftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- LeftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- LeftShoulder.Parent = Torso
- RightHip.Part0 = Torso
- RightHip.Part1 = Figure["Right Leg"]
- RightHip.MaxVelocity = 0.1
- RightHip.Name = "Right Hip"
- RightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- RightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- RightHip.Parent = Torso
- LeftHip.Part0 = Torso
- LeftHip.Part1 = Figure["Left Leg"]
- LeftHip.MaxVelocity = 0.1
- LeftHip.Name = "Left Hip"
- LeftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- LeftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- LeftHip.Parent = Torso
- Neck.Part0 = Torso
- Neck.Part1 = Figure["Head"]
- Neck.MaxVelocity = 0.1
- Neck.Name = "Neck"
- Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- Neck.Parent = Torso
- local toolAnim = "None"
- local toolAnimTime = 0
- local function onRunning(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- local function onDied()
- pose = "Dead"
- end
- local function onJumping()
- pose = "Jumping"
- end
- local function onClimbing()
- pose = "Climbing"
- end
- local function onGettingUp()
- pose = "GettingUp"
- end
- local function onFreeFall()
- pose = "FreeFall"
- end
- local function onFallingDown()
- pose = "FallingDown"
- end
- local function onSeated()
- pose = "Seated"
- end
- local function onPlatformStanding()
- pose = "PlatformStanding"
- end
- local function moveJump()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = (3.14/ZStat)
- LeftShoulder.DesiredAngle = (-3.14/ZStat)
- RightHip.DesiredAngle = (0)
- LeftHip.DesiredAngle = (0)
- end
- local function moveFreeFall()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = (3.14/ZStat)
- LeftShoulder.DesiredAngle = (-3.14/ZStat)
- RightHip.DesiredAngle = (0)
- LeftHip.DesiredAngle = (0)
- end
- local function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder.DesiredAngle = (3.14 /2)
- LeftShoulder.DesiredAngle = (-3.14 /2)
- RightHip.DesiredAngle = (3.14 /2)
- LeftHip.DesiredAngle = (-3.14 /2)
- end
- local function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then return kid end
- end
- return nil
- end
- local function getToolAnim(tool)
- for _, c in ipairs(tool:GetChildren()) do
- if c.Name == "toolanim" and c.className == "StringValue" then
- return c
- end
- end
- return nil
- end
- local function animateTool()
- if (toolAnim == "None") then
- RightShoulder.DesiredAngle = (1.57)
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = (0)
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = (1.57)
- LeftShoulder.DesiredAngle = (1.0)
- RightHip.DesiredAngle = (1.57)
- LeftHip.DesiredAngle = (1.0)
- return
- end
- end
- local function move(time)
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- local climbFudge = 0
- if (pose == "Running") then
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- amplitude = 1
- frequency = 9
- elseif (pose == "Climbing") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- amplitude = 1
- frequency = 9
- climbFudge = 3.14
- else
- amplitude = 0.1
- frequency = 1
- end
- desiredAngle = amplitude * math.sin(time*frequency)
- RightShoulder.DesiredAngle = (desiredAngle + climbFudge) + ZStat2
- LeftShoulder.DesiredAngle = (desiredAngle - climbFudge) -ZStat2
- RightHip.DesiredAngle = (-desiredAngle)
- LeftHip.DesiredAngle = (-desiredAngle)
- local tool = getTool()
- if tool then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- --Humanoid.ChildAdded:connect(CheckTag)
- OriginalTime = 0.1
- Time = OriginalTime
- spawn(function()
- while Figure.Parent~=nil do
- --[[
- Time = Time + 0.1
- wait(OriginalTime)
- move(Time)
- ]]
- local _, time = wait(0.1)
- move(time)
- end
- end)
- end)
- end
- function give_sword()
- spawn(function()
- --[[
- local Tool0 = Instance.new("Tool")
- local Part1 = Instance.new("Part")
- local SpecialMesh2 = Instance.new("SpecialMesh")
- local Sound3 = Instance.new("Sound")
- local Sound4 = Instance.new("Sound")
- local Sound5 = Instance.new("Sound")
- Tool0.Name = "ClassicSword"
- Tool0.Parent = plr['Backpack']
- Tool0.TextureId = "rbxasset://Textures/Sword128.png"
- Tool0.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0)
- Tool0.GripForward = Vector3.new(-1, -0, -0)
- Tool0.GripPos = Vector3.new(0, 0, -1.5)
- Tool0.GripRight = Vector3.new(0, 1, 0)
- Tool0.GripUp = Vector3.new(0, 0, 1)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.CFrame = CFrame.new(214.957138, 4.28734684, -190.317474, 0.0910440385, -0.881099463, 0.464084357, 0.537011683, 0.435894847, 0.722229123, -0.838648558, 0.183463722, 0.512845576)
- Part1.Orientation = Vector3.new(-46.2400017, 42.1399994, 50.9300003)
- Part1.Position = Vector3.new(214.957138, 4.28734684, -190.317474)
- Part1.Rotation = Vector3.new(-54.6199989, 27.6499996, 84.0999985)
- Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part1.Size = Vector3.new(1, 0.800000012, 4)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Dark stone grey")
- Part1.Locked = true
- Part1.Reflectance = 0.40000000596046
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Dark stone grey")
- Part1.FormFactor = Enum.FormFactor.Plate
- Part1.formFactor = Enum.FormFactor.Plate
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "rbxasset://fonts/sword.mesh"
- SpecialMesh2.TextureId = "rbxasset://textures/SwordTexture.png"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- Sound3.Name = "SwordSlash"
- Sound3.Parent = Part1
- Sound3.SoundId = "http://www.roblox.com/asset/?id=12222216"
- Sound3.Volume = 0.69999998807907
- Sound4.Name = "SwordLunge"
- Sound4.Parent = Part1
- Sound4.SoundId = "http://www.roblox.com/asset/?id=12222208"
- Sound4.Volume = 0.60000002384186
- Sound5.Name = "Unsheath"
- Sound5.Parent = Part1
- Sound5.SoundId = "http://www.roblox.com/asset/?id=12222225"
- Sound5.Volume = 1
- local Tool = Tool0
- local Handle = Tool:WaitForChild("Handle")
- local function Create(ty)
- return function(data)
- local obj = Instance.new(ty)
- for k, v in pairs(data) do
- if type(k) == 'number' then
- v.Parent = obj
- else
- obj[k] = v
- end
- end
- return obj
- end
- end
- local BaseUrl = "rbxassetid://"
- local Players = game:GetService("Players")
- local Debris = game:GetService("Debris")
- local RunService = game:GetService("RunService")
- local DamageValues = {
- BaseDamage = 5,
- SlashDamage = 10,
- LungeDamage = 30
- }
- --For R15 avatars
- local Animations = {
- R15Slash = 522635514,
- R15Lunge = 522638767
- }
- local Damage = DamageValues.BaseDamage
- local Grips = {
- Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
- Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
- }
- local Sounds = {
- Slash = Handle:WaitForChild("SwordSlash"),
- Lunge = Handle:WaitForChild("SwordLunge"),
- Unsheath = Handle:WaitForChild("Unsheath")
- }
- local ToolEquipped = false
- --For Omega Rainbow Katana thumbnail to display a lot of particles.
- for i, v in pairs(Handle:GetChildren()) do
- if v:IsA("ParticleEmitter") then
- v.Rate = 20
- end
- end
- Tool.Grip = Grips.Up
- Tool.Enabled = true
- local function CheckIfAlive()
- return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
- end
- local function IsTeamMate(Player1, Player2)
- return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
- end
- local function TagHumanoid(humanoid, player)
- local Creator_Tag = Instance.new("ObjectValue")
- Creator_Tag.Name = "creator"
- Creator_Tag.Value = player
- Debris:AddItem(Creator_Tag, 2)
- Creator_Tag.Parent = humanoid
- end
- local function UntagHumanoid(humanoid)
- for i, v in pairs(humanoid:GetChildren()) do
- if v:IsA("ObjectValue") and v.Name == "creator" then
- v:Destroy()
- end
- end
- end
- local function Blow(Hit)
- if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
- return
- end
- local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
- if not RightArm then
- return
- end
- local RightGrip = RightArm:FindFirstChild("RightGrip")
- if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
- return
- end
- local character = Hit.Parent
- if character == Character then
- return
- end
- local humanoid = character:FindFirstChildOfClass("Humanoid")
- if not humanoid or humanoid.Health == 0 then
- return
- end
- local player = Players:GetPlayerFromCharacter(character)
- if player and (player == Player) then
- return
- end
- UntagHumanoid(humanoid)
- TagHumanoid(humanoid, Player)
- humanoid:TakeDamage(Damage)
- end
- local function Attack()
- Damage = DamageValues.SlashDamage
- Sounds.Slash:Play()
- if Humanoid then
- if Humanoid.RigType == Enum.HumanoidRigType.R6 then
- local Anim = Instance.new("StringValue")
- Anim.Name = "toolanim"
- Anim.Value = "Slash"
- Anim.Parent = Tool
- elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
- local Anim = Tool:FindFirstChild("R15Slash")
- if Anim then
- local Track = Humanoid:LoadAnimation(Anim)
- Track:Play(0)
- end
- end
- end
- end
- local function Lunge()
- Damage = DamageValues.LungeDamage
- Sounds.Lunge:Play()
- if Humanoid then
- if Humanoid.RigType == Enum.HumanoidRigType.R6 then
- local Anim = Instance.new("StringValue")
- Anim.Name = "toolanim"
- Anim.Value = "Lunge"
- Anim.Parent = Tool
- elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
- local Anim = Tool:FindFirstChild("R15Lunge")
- if Anim then
- local Track = Humanoid:LoadAnimation(Anim)
- Track:Play(0)
- end
- end
- end
- wait(0.2)
- Tool.Grip = Grips.Out
- wait(0.6)
- Tool.Grip = Grips.Up
- Damage = DamageValues.SlashDamage
- end
- Tool.Enabled = true
- LastAttack = 0
- local function Activated()
- if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
- return
- end
- Tool.Enabled = false
- local Tick = RunService.Stepped:wait()
- if (Tick - LastAttack < 0.2) then
- Lunge()
- else
- Attack()
- end
- LastAttack = Tick
- --wait(0.5)
- Damage = DamageValues.BaseDamage
- local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
- Name = "R15Slash",
- AnimationId = BaseUrl .. Animations.R15Slash,
- Parent = Tool
- })
- local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
- Name = "R15Lunge",
- AnimationId = BaseUrl .. Animations.R15Lunge,
- Parent = Tool
- })
- Tool.Enabled = true
- end
- local function Equipped()
- Character = Tool.Parent
- Player = Players:GetPlayerFromCharacter(Character)
- Humanoid = Character:FindFirstChildOfClass("Humanoid")
- Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
- if not CheckIfAlive() then
- return
- end
- ToolEquipped = true
- Sounds.Unsheath:Play()
- end
- local function Unequipped()
- Tool.Grip = Grips.Up
- ToolEquipped = false
- end
- Tool.Activated:Connect(Activated)
- Tool.Equipped:Connect(Equipped)
- Tool.Unequipped:Connect(Unequipped)
- local Connection = Handle.Touched:Connect(Blow)
- ]]
- local Tool0 = Instance.new("Tool")
- local Part2 = Instance.new("Part")
- local SpecialMesh3 = Instance.new("SpecialMesh")
- --local Sparkles7 = Instance.new("Sparkles")
- --local Sparkles8 = Instance.new("Sparkles")
- Tool0.Name = "Darkheart"
- Tool0.Parent = plr['Backpack']
- Tool0.TextureId = "http://www.roblox.com/asset/?id=16868189"
- Tool0.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0)
- Tool0.GripForward = Vector3.new(-1, -0, -0)
- Tool0.GripPos = Vector3.new(0, 0, -1.5)
- Tool0.GripRight = Vector3.new(0, 1, 0)
- Tool0.GripUp = Vector3.new(0, 0, 1)
- Part2.Name = "Handle"
- Part2.Parent = Tool0
- Part2.CFrame = CFrame.new(-18.6640892, 0.400011003, 9.11577606, -1, -1.7095083e-06, -2.80470631e-05, 1.70952512e-06, -1, -6.01045372e-07, -2.80470631e-05, -6.01093348e-07, 1)
- Part2.Orientation = Vector3.new(0, 0, 180)
- Part2.Position = Vector3.new(-18.6640892, 0.400011003, 9.11577606)
- Part2.Rotation = Vector3.new(0, 0, 180)
- Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part2.Velocity = Vector3.new(-0.00113814184, 0.00240389677, -0.00323618972)
- Part2.Size = Vector3.new(1, 0.800000012, 4)
- Part2.BottomSurface = Enum.SurfaceType.Smooth
- Part2.BrickColor = BrickColor.new("Dark stone grey")
- Part2.Reflectance = 0.69999998807907
- Part2.RotVelocity = Vector3.new(-0.00962590333, 0.00151013187, -0.0043386193)
- Part2.TopSurface = Enum.SurfaceType.Smooth
- Part2.brickColor = BrickColor.new("Dark stone grey")
- SpecialMesh3.Parent = Part2
- SpecialMesh3.MeshId = "rbxasset://fonts/sword.mesh"
- SpecialMesh3.Scale = Vector3.new(0.800000012, 0.800000012, 1)
- SpecialMesh3.VertexColor = Vector3.new(0, 0, 0)
- SpecialMesh3.TextureId = "rbxasset://textures/SwordTexture.png"
- SpecialMesh3.MeshType = Enum.MeshType.FileMesh
- --[[
- Sparkles7.Name = "Sparkles1"
- Sparkles7.Parent = Part2
- Sparkles7.SparkleColor = Color3.fromRGB(66, 66, 66)
- Sparkles8.Name = "Sparkles1"
- Sparkles8.Parent = Part2
- Sparkles8.SparkleColor = Color3.fromRGB(0, 0, 0)
- ]]
- -------- OMG HAX
- local r = game:service("RunService")
- local damage = 20
- local slash_damage = 18
- local lunge_damage = 36
- local sword = Part2
- local Tool = Tool0
- local SlashSound = Instance.new("Sound")
- SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
- SlashSound.Parent = sword
- SlashSound.Volume = .7
- local LungeSound = Instance.new("Sound")
- LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
- LungeSound.Parent = sword
- LungeSound.Volume = .6
- local UnsheathSound = Instance.new("Sound")
- UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
- UnsheathSound.Parent = sword
- UnsheathSound.Volume = 1
- local function tagHumanoid(humanoid, player)
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = player
- creator_tag.Name = "creator"
- creator_tag.Parent = humanoid
- game:GetService("Debris"):AddItem(creator_tag, 1)
- end
- local function DarkKill(character, humanoid, attacker)
- if (character:FindFirstChild("ForceField") ~= nil) then return end
- local childs = character:GetChildren()
- local colors = {}
- tagHumanoid(humanoid, attacker)
- humanoid.Health = 0
- for i=1,#childs do
- if (childs[i].className == "Part") then
- colors[i] = childs[i].BrickColor
- childs[i].BrickColor = BrickColor.new(26)
- childs[i].CanCollide = true
- childs[i].Anchored = true
- end
- end
- wait(.25)
- for i=1,#childs do
- if (childs[i].className == "Part") then
- local b = Instance.new("BodyVelocity")
- b.velocity = Vector3.new(math.random() - .5, 0, math.random() - .5).unit * 80
- b.maxForce = Vector3.new(1e5,1e5,1e5)
- b.Parent = childs[i]
- end
- end
- for i=1,#childs do
- if (childs[i].className == "Part") then
- childs[i].Anchored = false
- end
- end
- end
- local function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- local vCharacter = Tool.Parent
- local vPlayer = game:GetService("Players"):GetPlayerFromCharacter(vCharacter)
- local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
- if humanoid~=nil and humanoid ~= hum and hum ~= nil and hum.Health > 0 and humanoid.Health > 0 then
- -- final check, make sure sword is in-hand
- local right_arm = vCharacter:FindFirstChild("Right Arm")
- if (right_arm ~= nil) then
- local joint = right_arm:FindFirstChild("RightGrip")
- if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
- hum.Health = hum.Health + (damage * .4)
- if humanoid.Health > damage then
- tagHumanoid(humanoid, vPlayer)
- humanoid:TakeDamage(damage)
- else
- DarkKill(humanoid.Parent, humanoid, vPlayer)
- end
- end
- end
- end
- end
- local function attack()
- damage = slash_damage
- SlashSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Slash"
- anim.Parent = Tool
- end
- local function swordUp()
- Tool.GripForward = Vector3.new(-1,0,0)
- Tool.GripRight = Vector3.new(0,1,0)
- Tool.GripUp = Vector3.new(0,0,1)
- end
- local function swordOut()
- Tool.GripForward = Vector3.new(0,0,1)
- Tool.GripRight = Vector3.new(0,-1,0)
- Tool.GripUp = Vector3.new(-1,0,0)
- end
- local function swordAcross()
- -- parry
- end
- local function lunge()
- damage = lunge_damage
- LungeSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Lunge"
- anim.Parent = Tool
- local torso = (Tool.Parent:FindFirstChild("Torso") or Tool.Parent:FindFirstChild("HumanoidRootPart"))
- --[[
- local force = Instance.new("BodyVelocity")
- force.velocity = Vector3.new(0,10,0) --(Tool.Parent:FindFirstChild("Torso") or Tool.Parent:FindFirstChild("HumanoidRootPart")).CFrame.lookVector * 80
- force.Parent = torso
- ]]
- wait(0.2)
- swordOut()
- wait(0.6)
- swordUp()
- damage = slash_damage
- end
- Tool.Enabled = true
- local last_attack = 0
- local function onActivated()
- if not Tool.Enabled then
- return
- end
- Tool.Enabled = false
- local character = Tool.Parent;
- local humanoid = character.Humanoid
- if humanoid == nil then
- print("Humanoid not found")
- return
- end
- t = r.Stepped:wait()
- if (t - last_attack < .2) then
- pcall(function()
- lunge()
- end)
- else
- pcall(function()
- attack()
- end)
- end
- last_attack = t
- --wait(.5)
- Tool.Enabled = true
- end
- local function onEquipped()
- UnsheathSound:play()
- end
- Tool.Activated:connect(onActivated)
- Tool.Equipped:connect(onEquipped)
- local connection = sword.Touched:connect(blow)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement