How would I Break off a players limb when they get Hit by a sword

Hello! So I’m making a fighting game cald Ro-Fighters and the first weapon I made was a sword, It works :sparkles:flawlessly.:sparkles: but I want to make it so that it has a 1,20 chance of cutting someone’s limb off that it hits! ( For all limbs ) if its their head I want them to be just, dead but if its any other part like arms or legs I want it to not kill them. If they are missing both of their legs I want them to crawl and if they have one I want them to walk slower.

But the question I have is, How can I do this?

3 Likes

You maybe need to use BreakJoints(), and string.find() to find what you hit (hit.Name). So you will probably need to make a function for Touched(hit). It will check if hit.Parent is a part of a Character (using Humanoid). If it is, then it would probably de-anchor then break the joints of it. It would look like:

function Touched(hit)
	if not hit or not hit.Parent or Tool.Enabled then return end
	local hum,ff = hit.Parent:FindFirstChildOfClass("Humanoid"),hit.Parent:FindFirstChildOfClass("ForceField")
	if not hum or hum.Health <= 0 or ff or IsTeamMate(Services.Players:GetPlayerFromCharacter(hum.Parent),Player) or IsInTable(HitHumanoids,hum) then return end
	
	HitHumanoids[#HitHumanoids+1]=hum
	UntagHumanoid(hum)
	TagHumanoid(hum,Player)
	hum:TakeDamage() --damage rate here
	if not string.find(string.lower(hit.Name),"root") and ((string.find(string.lower(hit.Name),"torso") or string.find(string.lower(hit.Name),"head")) and Random.new():NextNumber(0,100) <= 50) or (not string.find(string.lower(hit.Name),"torso") and not string.find(string.lower(hit.Name),"head") and not string.find(string.lower(hit.Name),"root")) then
		hit.Anchored = false
		hit:BreakJoints()
	end
end
1 Like

That were the problem starts, If I just made it so that the joints would break the whole character would fall apart.

If you know the game in ROBLOX, ZO. I want the players joints to break of like that except, they wont just instantly die

No, just break the joint between the hit Part and the actual Character body.

So would I do something like this?

hit.Parent.Humanoid:BreakJoints(Head)

No, the Humanoid is just to see if what you touched is part of a Character.

Then how would I be able to achieve this?

Take hit as the part that the weapon touched, then use BreakJoints (or another function that works the same way) to break the joint between the part touched and the actual body (if it is a body).
After that I’ve never went deeper for this type of thing but it might work.

1 Like

that works for any people looking on the forum

this was made a year ago :moyai:

2 Likes

just saying because for some reason you didnt make it the solution…

But who said I would find/use any solutions given?

also you could have messaged me even if there wasn’t a solution…

Its necro bumping and its bumping old post when new post need help more than old post.