Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = owner
- local char = plr.Character
- local hum = char:FindFirstChildOfClass("Humanoid")
- local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
- local head = char:FindFirstChild("Head")
- if hum.RigType ~= Enum.HumanoidRigType.R6 then warn("Must be R6 rig to run this script.") return end
- local tool = Instance.new("Tool")
- local handle = Instance.new("Part")
- local SpecialMesh2 = Instance.new("SpecialMesh")
- tool.Name = "AlmightyToast's Sword"
- tool.Parent = plr.Backpack
- tool.TextureId = 'rbxassetid:/4911466046'
- handle.Name = "Handle"
- handle.Parent = tool
- handle.Size = Vector3.new(3.1400001, 0.195999995, 3.1400001)
- handle.BottomSurface = Enum.SurfaceType.Smooth
- handle.CanCollide = false
- handle.TopSurface = Enum.SurfaceType.Smooth
- SpecialMesh2.Parent = handle
- SpecialMesh2.MeshId = "rbxassetid://3676810102"
- SpecialMesh2.Scale = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- SpecialMesh2.TextureId = "rbxassetid://3676810220"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- for i,v in pairs(tool:GetChildren()) do
- if v:IsA("Part") then
- v.Massless = true
- v.Locked = true
- v.Anchored = false
- v.CanCollide = false
- if v ~= handle then
- local weld = Instance.new("Weld")
- weld.Part0 = handle
- weld.Part1 = v
- weld.C0 = handle.CFrame:Inverse()
- weld.C1 = v.CFrame:Inverse()
- weld.Parent = v
- else
- v.CanCollide = true
- end
- end
- end
- tool.Parent = char
- local debris = game:GetService("Debris")
- local tween = game:GetService("TweenService")
- local meta = {
- tier = 1,
- sharpness = -3,
- knockback = 0,
- }
- local using = false
- local equipped = false
- local holding = false
- local stamina = 100
- local dmg = 15 + (5 * meta.tier) + (5 * meta.sharpness)
- local kb = 25 + (5 * meta.knockback)
- local block_reduce = 0.7
- local ls = nil
- local blocking = false
- local combat_18 = true
- local first_person = true
- local hurt_fx = false
- local can_w_tap = false
- if combat_18 then
- speed = 0
- else
- speed = 0.12
- end
- local grips = {
- swing = CFrame.new(-1.12343681, 7.46069873e-14, 0.865265131, -2.96722469e-08, 0.678822041, -0.734302819, -1, -4.37113883e-08, 0, -3.20973932e-08, 0.734302819, 0.678822041),
- block = CFrame.new(-0.825168073, -0.020077154, 1.00834012, -0.275093406, 0.960726619, -0.0364401713, -0.146487176, -0.0044247508, 0.989202619, 0.950192153, 0.277461171, 0.141951352),
- hold = CFrame.new(-1.10684741, 4.97379915e-14, 0.99055028, -3.20973932e-08, 0.734302819, 0.6788221, -1, -4.37113883e-08, 0, 2.96722487e-08, -0.6788221, 0.734302819),
- }
- tool.Grip = grips.hold
- warn([[
- - Made by KrYn0MoRe
- - W-tap for extra knockback
- - Hold R-Click to block 70% damage
- - Hold Left Control makes you sprint
- ]])
- hum.JumpPower = 30
- local hscript = char:FindFirstChild("Health")
- if hscript then
- hscript:Destroy()
- end
- local ttip = tool.Name
- ttip = ttip .. '\n'
- for enchant,lvl in pairs(meta) do
- --if lvl ~= 0 then
- ttip = ttip .. '\n'
- ttip = ttip .. enchant .. ' ' .. lvl
- --end
- end
- ttip = ttip .. '\n'
- ttip = ttip .. '\n' .. 'When in main hand:'
- ttip = ttip .. '\n'
- ttip = ttip .. '\n' .. speed .. ' Attack Speed'
- ttip = ttip .. '\n' .. dmg .. ' Attack Damage'
- print(ttip)
- tool.ToolTip = ttip
- local aid = 0
- function add_aid()
- aid = aid + 1
- return aid
- end
- function check_aid(cid)
- if aid == cid then
- return true
- end
- end
- local walkremote = Instance.new("RemoteEvent")
- walkremote.Parent = tool
- walkremote.OnServerEvent:Connect(function(plr,mode,data)
- if mode == 1 then
- can_w_tap = data
- end
- end)
- NLS([[
- player = game:GetService("Players").LocalPlayer
- mouse = player:GetMouse()
- char = player.Character
- hum = char:FindFirstChildOfClass("Humanoid")
- local walkremote = script.Parent
- local oldspeed = hum.WalkSpeed
- local eating = false
- local running = false
- mouse.KeyDown:Connect(function(key)
- if string.byte(key) == 50 then
- running = true
- if not eating then
- hum.WalkSpeed = 24
- walkremote:FireServer(1,true)
- end
- end
- end)
- mouse.KeyUp:Connect(function(key)
- if string.byte(key) == 50 then
- running = false
- if not eating then
- hum.WalkSpeed = oldspeed
- walkremote:FireServer(1,false)
- end
- end
- if key == 'w' and hum.WalkSpeed == 24 then
- walkremote:FireServer(1,true)
- end
- end)
- walkremote.OnClientEvent:Connect(function(mode,data)
- if mode == 1 then
- if data == true then
- eating = true
- hum.WalkSpeed = 10
- if running then
- walkremote:FireServer(1,false)
- end
- elseif data == false then
- eating = false
- if running then
- hum.WalkSpeed = 24
- walkremote:FireServer(1,true)
- elseif not running then
- hum.WalkSpeed = oldspeed
- walkremote:FireServer(2,false)
- walkremote:FireServer(1,false)
- end
- end
- end
- end)
- ]],walkremote)
- local effects = {}
- function effects.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
- local hitsound2 = Instance.new("Sound")
- hitsound2.SoundId = 'rbxassetid://3362346832'
- hitsound2.Volume = 1.5
- hitsound2.Parent = handle
- local critsound = Instance.new("Sound")
- critsound.SoundId = 'rbxassetid://4801410586'
- critsound.Volume = 1.5
- critsound.Parent = handle
- function effects.effect(par,tarhum,weld,damage,targtorso,crit)
- if not combat_18 then
- local confirm = Instance.new("IntValue",par)
- confirm.Name = plr.Name .. 'swordhit'
- confirm.Parent = par
- debris:AddItem(confirm,0.12)
- end
- tarhum:TakeDamage(damage)
- if not hitsound2 then
- hitsound2 = Instance.new("Sound")
- hitsound2.SoundId = 'rbxassetid://3362346832'
- hitsound2.Volume = 1.5
- hitsound2.Parent = handle
- end
- if not critsound then
- critsound = Instance.new("Sound")
- critsound.SoundId = 'rbxassetid://4801410586'
- critsound.Volume = 1.5
- critsound.Parent = handle
- end
- if math.random(1,2) == 1 and crit then
- critsound.SoundId = 'rbxassetid://4801410586'
- elseif math.random(1,2) == 2 and crit then
- critsound.SoundId = 'rbxassetid://4801410149'
- elseif math.random(1,2) == 1 then
- hitsound2.SoundId = 'rbxassetid://3362346832'
- else
- hitsound2.SoundId = 'rbxassetid://3362337129'
- end
- if crit then
- critsound:Play()
- else
- hitsound2:Play()
- end
- --[[
- spawn(function()
- repeat wait() until not hitsound2.IsPlaying
- hitsound2.Parent = nil
- end)
- ]]
- spawn(function()
- local _kb = kb
- if can_w_tap then
- can_w_tap = false
- _kb = _kb*1.5
- end
- local dir = (targtorso.Position-torso.Position).Unit
- local b = Instance.new("BodyVelocity")
- b.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- b.Velocity = Vector3.new(0,9,0) + (dir*_kb*2.25)
- targtorso.Velocity = targtorso.Velocity + Vector3.new(0,10,0) + (torso.CFrame.LookVector*_kb)
- b.Parent = targtorso
- debris:AddItem(b,0.1)
- end)
- if hurt_fx then
- for i,v in pairs(par:GetChildren()) do
- if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" and not v:IsDescendantOf(char) and not v.Parent:IsA("Tool") and v.Name ~= "fallblock" then
- local weld = Instance.new("Weld")
- local part = v:Clone()
- part.CanCollide = false
- part.Massless = true
- part.Anchored = false
- for i,n in pairs(part:GetDescendants()) do
- if not n:IsA("SpecialMesh") then
- n:Destroy()
- end
- if n:IsA("SpecialMesh") then
- n.TextureId = ""
- n.Scale = n.Scale * 1.001
- end
- end
- weld.Part0 = part
- weld.Part1 = v
- weld.Parent = part
- part.BrickColor = BrickColor.new("Really red")
- part.Size = v.Size * 1.001
- part.Material = Enum.Material.SmoothPlastic
- part.CFrame = v.CFrame
- part.Parent = v.Parent
- part.Name = "hurtcolor"
- if 0.6 >= v.Transparency then
- part.Transparency = 0.6
- end
- if v.Transparency > 0.6 then
- part.Transparency = v.Transparency*1.5
- end
- part.CanCollide = false
- game:GetService("Debris"):AddItem(part,0.1)
- end
- end
- end
- end
- local stamina = 100
- local function recharge()
- if 100 > stamina then
- stamina = stamina + 10
- end
- if stamina > 100 then
- stamina = 100
- end
- end
- spawn(function()
- while wait(0.06) do
- wait(0.06)
- recharge()
- end
- end)
- local isFalling = false
- hum.StateChanged:Connect(function(old,new)
- if new == Enum.HumanoidStateType.Landed then
- isFalling = false
- elseif new == Enum.HumanoidStateType.Running then
- isFalling = false
- elseif new == Enum.HumanoidStateType.RunningNoPhysics then
- isFalling = false
- elseif new == Enum.HumanoidStateType.Jumping then
- isFalling = true
- elseif new == Enum.HumanoidStateType.FallingDown then
- isFalling = true
- elseif new == Enum.HumanoidStateType.Freefall then
- isFalling = true
- elseif new == Enum.HumanoidStateType.Climbing then
- isFalling = false
- end
- end)
- local hitanimid = 0
- local function hit(target,close)
- local cid = add_aid()
- spawn(function()
- hitanimid = 1
- if hitanimid == 1 and check_aid(cid) then else return end
- tween:Create(tool,TweenInfo.new(0.12),{Grip = grips.swing}):Play()
- hitanimid = 2
- wait(0.08)
- if hitanimid == 2 and check_aid(cid) then else return end
- tween:Create(tool,TweenInfo.new(0.12),{Grip = grips.block}):Play()
- hitanimid = 3
- wait(0.04)
- if hitanimid == 3 and check_aid(cid) then else return end
- tween:Create(tool,TweenInfo.new(0.12),{Grip = grips.hold}):Play()
- end)
- if (combat_18 or (stamina > 30 and not combat_18)) and ((target and close) or not first_person) then else return end
- local temp_dmg = 0
- local crit = false
- if combat_18 then
- temp_dmg = dmg
- else
- if isFalling then
- temp_dmg = (dmg*1.57142857)
- crit = true
- elseif stamina > 30 then
- temp_dmg = dmg
- end
- stamina = 0
- end
- local connection
- if not first_person then
- connection = handle.Touched:Connect(function(obj)
- local targchar,targtorso,targhum
- pcall(function()
- targchar = obj.Parent
- end)
- pcall(function()
- targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("HumanoidRootPart")
- end)
- pcall(function()
- targhum = targchar:FindFirstChildOfClass("Humanoid")
- end)
- if targchar and targchar ~= char and targtorso and targhum then
- if targhum ~= nil then
- if targhum.Parent then
- if not targhum.Parent:FindFirstChild(plr.Name .. "swordhit 32k") and obj.Parent:IsA("Model") and targhum.Health > 0 then
- effects.effect(targhum.Parent,targhum,targchar.PrimaryPart or targtorso,temp_dmg,targtorso,crit)
- end
- end
- end
- end
- end)
- elseif first_person then
- local targchar,targtorso,targhum
- for i,v in pairs(workspace:GetChildren()) do
- if target:IsDescendantOf(v) then
- targchar = v
- end
- end
- --[[
- pcall(function()
- targchar = target.Parent
- end)
- ]]
- pcall(function()
- targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("HumanoidRootPart")
- end)
- pcall(function()
- targhum = targchar:FindFirstChildOfClass("Humanoid")
- end)
- if target and targchar and targchar ~= char and targtorso and targhum then
- if targhum ~= nil then
- if targhum.Parent then
- if not targhum.Parent:FindFirstChild(plr.Name .. "swordhit 32k") and targchar:IsA("Model") and targhum.Health > 0 then
- effects.effect(targhum.Parent,targhum,targchar.PrimaryPart,temp_dmg,targtorso,crit)
- end
- end
- end
- end
- end
- if not combat_18 then
- wait(0.12)
- end
- if connection then
- spawn(function()
- wait(0.1)
- connection:Disconnect()
- end)
- end
- end
- local function CheckIfAlive()
- local alive = false;
- if (plr and plr.Parent and char and char.Parent and hum and hum.Parent and hum.Health > 0 and torso and torso.Parent and head and head.Parent) then
- alive = true;
- end;
- return alive;
- end;
- tool.Equipped:Connect(function()
- char = tool.Parent;
- plr = game:GetService("Players"):GetPlayerFromCharacter(char);
- hum = char:FindFirstChildOfClass("Humanoid");
- torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart");
- head = char:FindFirstChild("Head");
- if not CheckIfAlive() then tool.Parent = nil return end;
- equipped = true
- end)
- tool.Unequipped:Connect(function()
- if 0 >= hum.Health then
- tool:Destroy()
- end
- tween:Create(tool,TweenInfo.new(0),{Grip = grips.hold}):Play()
- blocking = false
- equipped = false
- end)
- local mouseremote = Instance.new("RemoteEvent")
- mouseremote.Parent = tool
- NLS([[
- workspace.Camera.FieldOfView = 90
- local plr = game:GetService("Players").LocalPlayer
- local char = plr.Character
- local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
- local hum = char:FindFirstChildOfClass("Humanoid")
- local mouse = plr:GetMouse()
- local remote = script.Parent
- mouse.TargetFilter = char
- plr.CameraMode = Enum.CameraMode.LockFirstPerson
- mouse.Button1Down:Connect(function()
- local target = mouse.Target
- local mag = nil
- local close = false
- if target and torso then
- mag = (torso.Position - target.Position).magnitude
- end
- if mag and 9 >= mag then
- close = true
- end
- remote:FireServer(1,target,close)
- end)
- mouse.Button2Down:Connect(function()
- remote:FireServer(2,true)
- end)
- mouse.Button2Up:Connect(function()
- remote:FireServer(2,false)
- end)
- ]],mouseremote)
- local curhealth = hum.Health
- hum.HealthChanged:Connect(function(newhealth)
- if curhealth > newhealth and newhealth > 0 then
- if blocking then
- local dmg = curhealth-newhealth
- local heal = dmg*block_reduce
- curhealth = hum.Health + heal
- hum.Health += heal
- end
- end
- curhealth = hum.Health
- end)
- mouseremote.OnServerEvent:Connect(function(plr,mode,data,data2)
- if mode == 1 and equipped and not using and not blocking then
- using = true
- hit(data,data2)
- using = false
- end
- if mode == 2 then
- add_aid()
- if data then
- blocking = true
- tween:Create(tool,TweenInfo.new(0),{Grip = grips.block}):Play()
- elseif not data then
- blocking = false
- tween:Create(tool,TweenInfo.new(0),{Grip = grips.hold}):Play()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement