Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone change this function so players don't tie, but it doesnt "Untag", and glitch?

Asked by 10 years ago

I want the swordfighting style to be normal, right now this function causes untag, if two players were to touch eachother at the same time, with a linked sword on a lunge/slash attack. What I was hoping for was just no ties! It's really annoying me, and my game is losing visits. I need help!! Here's the function, of "function blow(hit)", inside of the linkedsword, I hope you can help me out here, thanks!

function blow(hit)
if (hit.Parent == nil) then return end
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid")
if humanoid~=nil and humanoid ~= hum and hum ~= nil and hum.Health > 0 then
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

Remember, I want it to be EXACTLY like the linked sword, the problem with it right now is that if both players were to both charge, and lunge at eachother the first player that tags the opponent deals damage, and the opponents sword just goes through them without dealing damage. I want them both to deal damage, and yet just not tie. Please help!

1 answer

Log in to vote
0
Answered by 10 years ago

First, Is the variable Tool = script.Parent, Second, check to see if vPlayer is not nil, third, you can't make it so players don't tie, both of them can die no matter what, so you have to make it so that the script detects both of them dying, so make it a tie.

0
No, I want a non tie, and it is possible. Wrongmistake 0 — 10y
Ad

Answer this question