--========================================================-- -- CLIENT SWORD -- R6 + R15 -- MOBILE + PC -- UPRIGHT SWORD -- WORKING TOOL CREATION -- ORIGINAL SWING -- LOCAL VISUAL RAGDOLL -- RED VISUAL EFFECTS -- NO SOUND --========================================================-- local Players = game:GetService("Players") local Debris = game:GetService("Debris") local Player = Players.LocalPlayer local SWING_COOLDOWN = 0.65 local HIT_DISTANCE = 5 local Swinging = false local Sword = nil --========================================================-- -- PART CREATOR --========================================================-- local function Part(Name, Size, Color, Material) local P = Instance.new("Part") P.Name = Name P.Size = Size P.Color = Color P.Material = Material or Enum.Material.Metal P.Anchored = false P.CanCollide = false P.CanTouch = false P.CanQuery = false P.Massless = true P.TopSurface = Enum.SurfaceType.Smooth P.BottomSurface = Enum.SurfaceType.Smooth return P end --========================================================-- -- CREATE SWORD --========================================================-- local function createSword() local Character = Player.Character if not Character then return nil end local Backpack = Player:FindFirstChild("Backpack") if not Backpack then return nil end local Existing = Backpack:FindFirstChild("Sword") or Character:FindFirstChild("Sword") if Existing and Existing:IsA("Tool") then return Existing end local Tool = Instance.new("Tool") Tool.Name = "Sword" Tool.RequiresHandle = true Tool.CanBeDropped = false -- Upright sword Tool.Grip = CFrame.new(0, -0.65, 0) --====================================================-- -- HANDLE --====================================================-- local Handle = Part( "Handle", Vector3.new(0.22, 1.25, 0.22), Color3.fromRGB(40,40,45), Enum.Material.Metal ) Handle.Parent = Tool --====================================================-- -- WRAPS --====================================================-- for i = 1,6 do local Wrap = Part( "Wrap"..i, Vector3.new(0.3,0.12,0.3), Color3.fromRGB(15,15,20), Enum.Material.Metal ) Wrap.CFrame = Handle.CFrame * CFrame.new( 0, -0.5 + (i-1)*0.18, 0 ) Wrap.Parent = Tool local Weld = Instance.new("WeldConstraint") Weld.Part0 = Handle Weld.Part1 = Wrap Weld.Parent = Wrap end --====================================================-- -- GUARD --====================================================-- local Guard = Part( "Guard", Vector3.new(1.6,0.18,0.25), Color3.fromRGB(255,190,40), Enum.Material.Metal ) Guard.CFrame = Handle.CFrame * CFrame.new(0,0.7,0) Guard.Parent = Tool local GuardWeld = Instance.new("WeldConstraint") GuardWeld.Part0 = Handle GuardWeld.Part1 = Guard GuardWeld.Parent = Guard --====================================================-- -- BLADE --====================================================-- local Blade = Part( "Blade", Vector3.new(0.3,4.5,0.12), Color3.fromRGB(180,220,255), Enum.Material.Metal ) Blade.CanQuery = true Blade.CFrame = Handle.CFrame * CFrame.new(0,3.05,0) Blade.Parent = Tool local BladeWeld = Instance.new("WeldConstraint") BladeWeld.Part0 = Handle BladeWeld.Part1 = Blade BladeWeld.Parent = Blade --====================================================-- -- BLADE EDGE --====================================================-- local Edge = Part( "BladeEdge", Vector3.new(0.08,4.2,0.08), Color3.fromRGB(245,245,255), Enum.Material.Neon ) Edge.CFrame = Blade.CFrame * CFrame.new(0.18,0,0) Edge.Parent = Tool local EdgeWeld = Instance.new("WeldConstraint") EdgeWeld.Part0 = Blade EdgeWeld.Part1 = Edge EdgeWeld.Parent = Edge --====================================================-- -- TIP --====================================================-- local Tip = Part( "BladeTip", Vector3.new(0.3,0.45,0.12), Color3.fromRGB(200,230,255), Enum.Material.Metal ) Tip.CFrame = Blade.CFrame * CFrame.new(0,2.45,0) Tip.Parent = Tool local TipWeld = Instance.new("WeldConstraint") TipWeld.Part0 = Blade TipWeld.Part1 = Tip TipWeld.Parent = Tip --====================================================-- -- POMMEL --====================================================-- local Pommel = Part( "Pommel", Vector3.new(0.35,0.25,0.35), Color3.fromRGB(255,190,40), Enum.Material.Metal ) Pommel.CFrame = Handle.CFrame * CFrame.new(0,-0.68,0) Pommel.Parent = Tool local PommelWeld = Instance.new("WeldConstraint") PommelWeld.Part0 = Handle PommelWeld.Part1 = Pommel PommelWeld.Parent = Pommel --====================================================-- -- PARENT LAST --====================================================-- Tool.Parent = Backpack return Tool end --========================================================-- -- SHOULDERS --========================================================-- local function getShoulder(Character, Right) local Names if Right then Names = {"Right Shoulder","RightShoulder"} else Names = {"Left Shoulder","LeftShoulder"} end for _,Name in ipairs(Names) do local Motor = Character:FindFirstChild(Name,true) if Motor and Motor:IsA("Motor6D") then return Motor end end return nil end --========================================================-- -- RED EFFECT --========================================================-- local function redEffect(Position) local P = Instance.new("Part") P.Anchored = true P.CanCollide = false P.CanTouch = false P.CanQuery = false P.Transparency = 1 P.Size = Vector3.new(1,1,1) P.Position = Position P.Parent = workspace local A = Instance.new("Attachment") A.Parent = P local E = Instance.new("ParticleEmitter") E.Texture = "rbxasset://textures/particles/sparkles_main.dds" E.Color = ColorSequence.new( Color3.fromRGB(80,0,0), Color3.fromRGB(180,0,0) ) E.Rate = 0 E.Lifetime = NumberRange.new(0.25,0.7) E.Speed = NumberRange.new(3,8) E.SpreadAngle = Vector2.new(180,180) E.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0,0.22), NumberSequenceKeypoint.new(0.5,0.12), NumberSequenceKeypoint.new(1,0) }) E.Parent = A E:Emit(35) Debris:AddItem(P,1.5) end --========================================================-- -- RED GROUND MARK --========================================================-- local function redPool(Position) local P = Instance.new("Part") P.Name = "LocalRedPool" P.Anchored = true P.CanCollide = false P.CanTouch = false P.CanQuery = false P.Material = Enum.Material.SmoothPlastic P.Color = Color3.fromRGB(100,0,0) P.Size = Vector3.new(3.2,0.035,2.4) P.CFrame = CFrame.new(Position) * CFrame.Angles( 0, math.rad(math.random(0,360)), 0 ) P.Parent = workspace local Mesh = Instance.new("SpecialMesh") Mesh.MeshType = Enum.MeshType.Sphere Mesh.Scale = Vector3.new(1,0.08,1) Mesh.Parent = P for i = 1,24 do local S = Instance.new("Part") S.Anchored = true S.CanCollide = false S.CanTouch = false S.CanQuery = false S.Material = Enum.Material.SmoothPlastic S.Color = Color3.fromRGB( math.random(70,145), 0, 0 ) local Angle = math.rad(math.random(0,360)) local Distance = math.random(10,40)/10 local X = math.cos(Angle)*Distance local Z = math.sin(Angle)*Distance local Size = math.random(8,28)/100 S.Size = Vector3.new( Size*1.8, 0.025, Size ) S.Position = Position + Vector3.new(X,0.04,Z) S.Parent = workspace local M = Instance.new("SpecialMesh") M.MeshType = Enum.MeshType.Sphere M.Scale = Vector3.new(1,0.05,1) M.Parent = S end end --========================================================-- -- LOCAL RAGDOLL CLONE --========================================================-- local function ragdollClone(Character) if not Character then return end local Root = Character:FindFirstChild( "HumanoidRootPart" ) if not Root then return end Character.Archivable = true for _,Object in ipairs( Character:GetDescendants() ) do pcall(function() Object.Archivable = true end) end local Clone pcall(function() Clone = Character:Clone() end) if not Clone then return end Clone.Name = "LocalSwordRagdoll" Clone.Parent = workspace -- Remove scripts/tools for _,Object in ipairs( Clone:GetDescendants() ) do if Object:IsA("Script") or Object:IsA("LocalScript") or Object:IsA("ModuleScript") or Object:IsA("Tool") then Object:Destroy() end end local Humanoid = Clone:FindFirstChildOfClass( "Humanoid" ) if Humanoid then Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None Humanoid.AutoRotate = false Humanoid.PlatformStand = true pcall(function() Humanoid:ChangeState( Enum.HumanoidStateType.Physics ) end) end --====================================================-- -- CONVERT JOINTS --====================================================-- for _,Motor in ipairs( Clone:GetDescendants() ) do if Motor:IsA("Motor6D") then local P0 = Motor.Part0 local P1 = Motor.Part1 if P0 and P1 then local A0 = Instance.new("Attachment") local A1 = Instance.new("Attachment") A0.CFrame = Motor.C0 A1.CFrame = Motor.C1 A0.Parent = P0 A1.Parent = P1 local Constraint = Instance.new( "BallSocketConstraint" ) Constraint.Attachment0 = A0 Constraint.Attachment1 = A1 Constraint.LimitsEnabled = true Constraint.UpperAngle = 70 Constraint.TwistLimitsEnabled = true Constraint.TwistLowerAngle = -45 Constraint.TwistUpperAngle = 45 Constraint.Parent = P0 Motor.Enabled = false end end end --====================================================-- -- BODY COLLISION --====================================================-- for _,Object in ipairs( Clone:GetDescendants() ) do if Object:IsA("BasePart") then Object.CanCollide = true Object.CanTouch = false Object.CanQuery = false end end local CloneRoot = Clone:FindFirstChild( "HumanoidRootPart" ) if CloneRoot then CloneRoot.CanCollide = false CloneRoot.AssemblyLinearVelocity = Vector3.new( math.random(-5,5), 2, math.random(-5,5) ) CloneRoot.AssemblyAngularVelocity = Vector3.new( math.random(-5,5), math.random(-5,5), math.random(-5,5) ) end end --========================================================-- -- HIT --========================================================-- local function hitTarget(Character) if Character:GetAttribute( "LocalSwordHit" ) then return end local Humanoid = Character:FindFirstChildOfClass( "Humanoid" ) local Root = Character:FindFirstChild( "HumanoidRootPart" ) if not Humanoid or not Root then return end if Humanoid.Health <= 0 then return end Character:SetAttribute( "LocalSwordHit", true ) local Position = Root.Position -- Clone first so ragdoll doesn't depend -- on the real player's physics. ragdollClone(Character) -- Hide original locally for _,Object in ipairs( Character:GetDescendants() ) do if Object:IsA("BasePart") then Object.LocalTransparencyModifier = 1 Object.CanCollide = false elseif Object:IsA("Decal") then Object.Transparency = 1 end end Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None redEffect(Position) redEffect( Position + Vector3.new(0,1,0) ) redPool(Position) end --========================================================-- -- HIT CHECK --========================================================-- local function checkHits(Tool, AlreadyHit) local Blade = Tool:FindFirstChild("Blade") if not Blade then return end for _,Other in ipairs( Players:GetPlayers() ) do if Other ~= Player then local Character = Other.Character if Character and not AlreadyHit[Character] then local Humanoid = Character:FindFirstChildOfClass( "Humanoid" ) local Root = Character:FindFirstChild( "HumanoidRootPart" ) if Humanoid and Root and Humanoid.Health > 0 then if ( Blade.Position - Root.Position ).Magnitude <= HIT_DISTANCE then AlreadyHit[Character] = true hitTarget(Character) end end end end end end --========================================================-- -- SWING --========================================================-- local function swing(Tool) if Swinging then return end if not Tool then return end if Tool.Parent ~= Player.Character then return end Swinging = true local Character = Player.Character local Right = getShoulder( Character, true ) local Left = getShoulder( Character, false ) if not Right then Swinging = false return end local RightOriginal = Right.C0 local LeftOriginal = Left and Left.C0 local AlreadyHit = {} --====================================================-- -- WIND-UP --====================================================-- for i = 1,8 do local A = i/8 Right.C0 = RightOriginal:Lerp( RightOriginal * CFrame.Angles( math.rad(-55), math.rad(15), math.rad(65) ), A ) if Left then Left.C0 = LeftOriginal:Lerp( LeftOriginal * CFrame.Angles( math.rad(-25), math.rad(-10), math.rad(-25) ), A ) end task.wait(0.018) end --====================================================-- -- FAST SWING --====================================================-- for i = 1,12 do local A = i/12 Right.C0 = RightOriginal:Lerp( RightOriginal * CFrame.Angles( math.rad(35), math.rad(-20), math.rad(-105) ), A ) if Left then Left.C0 = LeftOriginal:Lerp( LeftOriginal * CFrame.Angles( math.rad(10), math.rad(5), math.rad(20) ), A ) end checkHits( Tool, AlreadyHit ) task.wait(0.012) end --====================================================-- -- FOLLOW THROUGH --====================================================-- for i = 1,8 do local A = i/8 Right.C0 = RightOriginal:Lerp( RightOriginal * CFrame.Angles( math.rad(65), math.rad(-5), math.rad(-55) ), A ) task.wait(0.018) end --====================================================-- -- RETURN --====================================================-- for i = 1,8 do local A = i/8 Right.C0 = Right.C0:Lerp( RightOriginal, A ) if Left then Left.C0 = Left.C0:Lerp( LeftOriginal, A ) end task.wait(0.018) end Right.C0 = RightOriginal if Left then Left.C0 = LeftOriginal end task.wait(SWING_COOLDOWN) Swinging = false end --========================================================-- -- MOBILE BUTTON --========================================================-- local function makeButton(Tool) local PlayerGui = Player:WaitForChild( "PlayerGui" ) local Old = PlayerGui:FindFirstChild( "SwordGui" ) if Old then Old:Destroy() end local Gui = Instance.new("ScreenGui") Gui.Name = "SwordGui" Gui.ResetOnSpawn = false Gui.Parent = PlayerGui local Button = Instance.new("TextButton") Button.Name = "SwingButton" Button.Size = UDim2.new( 0, 105, 0, 58 ) Button.Position = UDim2.new( 1, -125, 1, -165 ) Button.Text = "SWING" Button.TextScaled = true Button.Font = Enum.Font.GothamBold Button.BackgroundTransparency = 0.15 Button.Parent = Gui local Corner = Instance.new("UICorner") Corner.CornerRadius = UDim.new( 0, 12 ) Corner.Parent = Button Button.Activated:Connect( function() if Tool.Parent == Player.Character then swing(Tool) end end ) Tool.Unequipped:Connect( function() if Gui then Gui:Destroy() end end ) end --========================================================-- -- SETUP --========================================================-- local function setup(Tool) Tool.Equipped:Connect( function() makeButton(Tool) end ) Tool.Activated:Connect( function() swing(Tool) end ) end --========================================================-- -- START --========================================================-- local function giveSword() local Tool = createSword() if Tool then Sword = Tool setup(Tool) end end -- Wait until character exists if not Player.Character then Player.CharacterAdded:Wait() end task.wait(0.5) giveSword() --========================================================-- -- RESPAWN --========================================================-- Player.CharacterAdded:Connect( function() Sword = nil Swinging = false task.wait(0.7) giveSword() end )