Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- plr = owner
- equip = false
- char = Instance.new("Model",script)
- char.Name = plr.Name .." Sword"
- tool = Instance.new("Tool",nil)
- tool.Name = plr.Name .." Sword"
- tool.GripForward = Vector3.new(-1, 0, 0)
- tool.GripPos = Vector3.new(0, 0, -1.5)
- tool.GripRight = Vector3.new(0, 1, 0)
- tool.GripUp = Vector3.new(0, 0, 1)
- dmg = 0
- Animations = {
- R15Slash = 522635514,
- R15Lunge = 522638767
- }
- 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)
- }
- 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
- BaseUrl = "rbxassetid://"
- function attack()
- local Humanoid = tool.Parent:FindFirstChildOfClass("Humanoid")
- dmg = 5
- local s = Instance.new("Sound",main) s.Volume = 0.6 s.SoundId = "rbxassetid://12222216" s: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
- wait(.5)
- dmg = 0
- end
- function lunge()
- local Humanoid = tool.Parent:FindFirstChildOfClass("Humanoid")
- dmg = 20
- local s = Instance.new("Sound",main) s.Volume = 0.6 s.SoundId = "rbxassetid://12222208" s: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
- dmg = 0
- end
- LastAttack = 0
- tool.Activated:connect(function()
- local Tick = game:GetService("RunService").Stepped:wait()
- tool.Enabled = false
- if (Tick - LastAttack < 0.2) then
- lunge()
- else
- attack()
- end
- LastAttack = Tick
- 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
- })
- dmg = 0
- tool.Enabled = true
- end)
- face = plr.Character.Head:FindFirstChild("face")
- if face then
- tool.TextureId = face.Texture
- end
- main = Instance.new("Part",char)
- main.Size = Vector3.new(2.5, 4, 1)
- main.BrickColor = plr.Character.Head.BrickColor
- main.Material = "Plastic"
- main.Name = "Handle"
- main.Size = Vector3.new(1, 0.8, 4)
- main.Position = plr.Character.Head.Position
- main.Touched:connect(function(hit)
- local nub = hit.Parent
- for _,v in pairs (nub:children()) do
- if v:IsA("Humanoid") then
- v.Health = v.Health - dmg
- end
- end
- end)
- newface = Instance.new("Decal",main)
- if face then
- newface.Texture = face.Texture
- end
- newface.Face = "Back"
- detect = Instance.new("ClickDetector",main)
- detect.MaxActivationDistance = 16
- detect.MouseClick:connect(function(player)
- if player ~= owner then
- main.Parent = tool
- tool.Parent = player.Backpack
- detect:Destroy()
- end
- end)
- plr.Character.Parent = nil
- plr.Character = char
- NLS([[
- workspace.CurrentCamera.CameraSubject = owner.Character.Handle
- ]],char)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement