my sword script:
local TOOL = script.Parent local BLADE = TOOL.Blade local ANIMS = {} for index, CHILD in pairs(script:GetChildren()) do if CHILD.Name == "Slash" then table.insert(ANIMS,CHILD) end end local FIGHT = false local FRIENDLYFIRE = TOOL.FriendlyFire local IDLEANIM = nil local TRAIL = BLADE.Trail function Slash() if FIGHT == false then local HUM = TOOL.Parent:FindFirstChildOfClass("Humanoid") if HUM then TOOL.Slashing.Value = true BLADE.Swing.Pitch = math.random(8,12)/10 BLADE.Swing:Play() TRAIL.Enabled = true local SHOUT = script.Grunt:Clone() SHOUT.Parent = HUM.Torso SHOUT:Play() SHOUT.Pitch = math.random(8,12)/10 game:GetService("Debris"):AddItem(SHOUT,2) local BOD = Instance.new("BodyPosition",HUM.Torso) BOD.Position = HUM.Torso.CFrame * CFrame.new(0,0,-6).p BOD.P = 750 BOD.D = 35 BOD.MaxForce = BOD.MaxForce*25 local ANIM = HUM:LoadAnimation(ANIMS[math.random(1,#ANIMS)]) ANIM:Play() FIGHT = true local HIT = BLADE.Touched:Connect(function(TOUCHED) if TOUCHED.Parent:FindFirstChildOfClass("Humanoid") then local HUM = TOUCHED.Parent:FindFirstChildOfClass("Humanoid") local PASS = true if game.Players:FindFirstChild(HUM.Parent.Name) and FRIENDLYFIRE.Value == false and TOUCHED.Parent:FindFirstChildOfClass("ForceField") == nil then PASS = false end if PASS == true then HUM:TakeDamage(TOOL.Damage.Value) local creator = Instance.new("ObjectValue") local Debris = game:GetService("Debris") creator.Name = "creator" creator.Value = TOOL.Parent Debris:AddItem(creator, 2) creator.Parent = HUM end end end) ANIM.Stopped:Connect(function() TOOL.Slashing.Value = false BOD:Remove() TRAIL.Enabled = false HIT:Disconnect() wait() FIGHT = false end) end end end TOOL.Activated:Connect(function() Slash() end) TOOL.Equipped:Connect(function() local HUM = TOOL.Parent:FindFirstChildOfClass("Humanoid") if HUM and script:FindFirstChild("Idle") then IDLEANIM = HUM:LoadAnimation(script.Idle) IDLEANIM:Play() end end) TOOL.Unequipped:Connect(function() if IDLEANIM then IDLEANIM:Stop() end end)
reward script:
local Humanoid = script.Parent.Humanoid function PwntX_X() local tag = Humanoid.creator if tag ~= nil then if tag.Value ~= nil then local Leaderstats = tag.Value:WaitForChild("leaderstats") if Leaderstats ~= nil then Leaderstats.Money.Value = Leaderstats.Money.Value + 3 wait(0.1) script:remove() end end end end Humanoid.Died:connect(PwntX_X)