How to make my sword's Damage linked by My Stats Value ?
How to make my sword's Damage linked by My Stats Value
(Stats In player.Localplayer:WaitForChild("Stats"):WaitForChild("Sword").Value)
This Sword Scripts
002 | Handle = Tool:WaitForChild( "Handle" ) |
005 | return function (data) |
006 | local obj = Instance.new(ty) |
007 | for k, v in pairs (data) do |
008 | if type (k) = = 'number' then |
020 | Players = game:GetService( "Players" ) |
021 | Debris = game:GetService( "Debris" ) |
022 | RunService = game:GetService( "RunService" ) |
023 | local sword = Players.LocalPlayer:WaitForChild( "Stats" ):WaitForChild( "Sword" ) |
033 | R 15 Slash = 522635514 , |
037 | Damage = DamageValues.BaseDamage |
040 | Up = CFrame.new( 0 , 0 , - 1.70000005 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 1 , 0 ), |
041 | Out = CFrame.new( 0 , 0 , - 1.70000005 , 0 , 1 , 0 , 1 , - 0 , 0 , 0 , 0 , - 1 ) |
045 | Slash = Handle:WaitForChild( "SwordSlash" ), |
046 | Lunge = Handle:WaitForChild( "SwordLunge" ), |
047 | Unsheath = Handle:WaitForChild( "Unsheath" ) |
053 | for i, v in pairs (Handle:GetChildren()) do |
054 | if v:IsA( "ParticleEmitter" ) then |
062 | function IsTeamMate(Player 1 , Player 2 ) |
063 | return (Player 1 and Player 2 and not Player 1. Neutral and not Player 2. Neutral and Player 1. TeamColor = = Player 2. TeamColor) |
066 | function TagHumanoid(humanoid, player) |
067 | local Creator_Tag = Instance.new( "ObjectValue" ) |
068 | Creator_Tag.Name = "creator" |
069 | Creator_Tag.Value = player |
070 | Debris:AddItem(Creator_Tag, 2 ) |
071 | Creator_Tag.Parent = humanoid |
074 | function UntagHumanoid(humanoid) |
075 | for i, v in pairs (humanoid:GetChildren()) do |
076 | if v:IsA( "ObjectValue" ) and v.Name = = "creator" then |
083 | if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then |
086 | local RightArm = Character:FindFirstChild( "Right Arm" ) or Character:FindFirstChild( "RightHand" ) |
090 | local RightGrip = RightArm:FindFirstChild( "RightGrip" ) |
091 | if not RightGrip or (RightGrip.Part 0 ~ = Handle and RightGrip.Part 1 ~ = Handle) then |
094 | local character = Hit.Parent |
095 | if character = = Character then |
098 | local humanoid = character:FindFirstChildOfClass( "Humanoid" ) |
099 | if not humanoid or humanoid.Health = = 0 then |
102 | local player = Players:GetPlayerFromCharacter(character) |
103 | if player and (player = = Player or IsTeamMate(Player, player)) then |
106 | UntagHumanoid(humanoid) |
107 | TagHumanoid(humanoid, Player) |
108 | humanoid:TakeDamage(Damage) |
114 | Damage = DamageValues.SlashDamage |
118 | if Humanoid.RigType = = Enum.HumanoidRigType.R 6 then |
119 | local Anim = Instance.new( "StringValue" ) |
120 | Anim.Name = "toolanim" |
123 | elseif Humanoid.RigType = = Enum.HumanoidRigType.R 15 then |
124 | local Anim = Tool:FindFirstChild( "R15Slash" ) |
126 | local Track = Humanoid:LoadAnimation(Anim) |
134 | Damage = DamageValues.LungeDamage |
139 | if Humanoid.RigType = = Enum.HumanoidRigType.R 6 then |
140 | local Anim = Instance.new( "StringValue" ) |
141 | Anim.Name = "toolanim" |
144 | elseif Humanoid.RigType = = Enum.HumanoidRigType.R 15 then |
145 | local Anim = Tool:FindFirstChild( "R15Lunge" ) |
147 | local Track = Humanoid:LoadAnimation(Anim) |
163 | Tool.Grip = Grips.Out |
167 | Damage = DamageValues.SlashDamage |
174 | if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then |
178 | local Tick = RunService.Stepped:wait() |
179 | if (Tick - LastAttack < 0.2 ) then |
186 | Damage = DamageValues.BaseDamage |
187 | local SlashAnim = (Tool:FindFirstChild( "R15Slash" ) or Create( "Animation" ) { |
189 | AnimationId = BaseUrl .. Animations.R 15 Slash, |
193 | local LungeAnim = (Tool:FindFirstChild( "R15Lunge" ) or Create( "Animation" ) { |
195 | AnimationId = BaseUrl .. Animations.R 15 Lunge, |
201 | function CheckIfAlive() |
202 | 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 ) |
206 | Character = Tool.Parent |
207 | Player = Players:GetPlayerFromCharacter(Character) |
208 | Humanoid = Character:FindFirstChildOfClass( "Humanoid" ) |
209 | Torso = Character:FindFirstChild( "Torso" ) or Character:FindFirstChild( "HumanoidRootPart" ) |
210 | if not CheckIfAlive() then |
214 | Sounds.Unsheath:Play() |
222 | Tool.Activated:Connect(Activated) |
223 | Tool.Equipped:Connect(Equipped) |
224 | Tool.Unequipped:Connect(Unequipped) |
226 | Connection = Handle.Touched:Connect(Blow) |