of     1   

Khaotixs
#184113803Monday, February 22, 2016 1:07 AM GMT

I'm a beginner scripter, and I want to edit a sword script, so when you hit someone with a sword, you heal a little bit, kind of like a vampire sword. Any tutorials or tips to help me make this?
00doggie
#184113948Monday, February 22, 2016 1:09 AM GMT

I would look on the wikipedia for anything related to what you are trying to do
00doggie
#184116282Monday, February 22, 2016 1:43 AM GMT

hey dude, idk if you still need help, but I got bored and succedded(screw spelling) and made the sword you were talking about this is what I changed in the sword script in the sword function: function Sword:Connect() Handle.Touched:connect(function(hit) local myPlayer = GLib.GetPlayerFromPart(Tool) local character, player, humanoid = GLib.GetCharacterFromPart(hit) if myPlayer~=nil and character~=nil and humanoid~=nil and myPlayer~=player then local isTeammate = GLib.IsTeammate(myPlayer, player) local myCharacter = myPlayer.Character local myHumanoid = myCharacter and myCharacter:FindFirstChild'Humanoid' if (Config.CanTeamkill.Value==true or isTeammate~=true) and (myHumanoid and myHumanoid:IsA'Humanoid' and myHumanoid.Health > 0) and (Config.CanKillWithForceField.Value or myCharacter:FindFirstChild'ForceField'==nil) then local doDamage = Config.IdleDamage.Value if Sword.State == 'Slashing' then doDamage = Config.SlashDamage.Value myHumanoid.Health = myHumanoid.Health + 5 elseif Sword.State == 'Lunging' then doDamage = Config.LungeDamage.Value myHumanoid.Health = myHumanoid.Health + 15 end GLib.TagHumanoid(humanoid, myPlayer, 1) humanoid:TakeDamage(doDamage) end end end) end
Khaotixs
#184119757Monday, February 22, 2016 2:30 AM GMT

@00 Thanks so much! I appreciate it! This is the type of scripting I like to learn, and I have a feeling exploring this script will both be good for my game, and good for practicing making scripts.
Khaotixs
#184120361Monday, February 22, 2016 2:39 AM GMT

@00 Btw Where do I put the script? Do I make a new local/normal script and put your programming in it? Do I add it to another script inside a sword?
Antheer
#184122834Monday, February 22, 2016 3:15 AM GMT

@00 You're a genius, sir.
George_Becker
#184124492Monday, February 22, 2016 3:39 AM GMT

Also for future reference, when the human takes damage, and health to the parent of the sword
00doggie
#184223770Wednesday, February 24, 2016 1:40 AM GMT

@devsyntax idk what you are talking about, but thanks. @center123987 I sent you a PM
George_Becker
#184229450Wednesday, February 24, 2016 3:00 AM GMT

Most swords are like this: function blow(hit) if (hit.Parent == nil) then return end -- happens when bullet hits sword local humanoid = hit.Parent:findFirstChild("Humanoid") local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character if humanoid~=nil and humanoid ~= hum and hum ~= nil then local eplayer=game.Players:getPlayerFromCharacter(humanoid.Parent) if eplayer and eplayer.TeamColor~=vPlayer.TeamColor then -- final check, make sure sword is in-hand local right_arm = vCharacter:FindFirstChild("Right Arm") if (right_arm ~= nil) then local joint = right_arm:FindFirstChild("RightGrip") if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then tagHumanoid(humanoid, vPlayer) humanoid:TakeDamage(damage) wait(1) untagHumanoid(humanoid) end end end end end Then, you can just add health to the owner of the sword: Like this: function blow(hit) if (hit.Parent == nil) then return end -- happens when bullet hits sword local humanoid = hit.Parent:findFirstChild("Humanoid") local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character if humanoid~=nil and humanoid ~= hum and hum ~= nil then local eplayer=game.Players:getPlayerFromCharacter(humanoid.Parent) if eplayer and eplayer.TeamColor~=vPlayer.TeamColor then -- final check, make sure sword is in-hand local right_arm = vCharacter:FindFirstChild("Right Arm") if (right_arm ~= nil) then local joint = right_arm:FindFirstChild("RightGrip") if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then tagHumanoid(humanoid, vPlayer) humanoid:TakeDamage(damage) vCharacter.Humanoid.Health = vCharacter.Humanoid.Health + 10 --How much health they gain every time they hit someone wait(1) untagHumanoid(humanoid) end end end end end
00doggie
#184261256Wednesday, February 24, 2016 9:04 PM GMT

yeah, I added like two lines to the actual script(myHumanoid.Health = myHumanoid.Health + 5) I just showed which function it is in withing the sword script

    of     1