Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I don't understand the hit code, when a player kicks another player?

How does it damage the other player? I don't understand... Could someone tell me how to use it??

2 comments

0

Can you explain what you mean? What hit code?

0

Like, the way to takedamage...

1 answer

✓ Accepted answer

Well, that's basically the Touched event. You would have it so it leads to their leg. The TakeDamage method could be used if you don't want to subtract theirs by a certain number. TakeDamage ONLY works if their is no forcefield is present, so that's pretty good so no spawn killing. Let me give you can example..

--Local script
plr = game.Players.LocalPlayer
char = plr.Character

function debounce(func)
    local isRunning = false
    return function(...)
        if not isRunning then
            isRunning = true
            func(...)
            isRunning = false
        end
    end
end


char["Right leg"].Touched:connect(debounce(function(hit) -- Not sure if it's 'Right leg'. You may want to check.
	if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
		victim = game.Players:GetPlayerFromCharacter(hit.Parent)
		victim.Character.Humanoid:TakeDamage(15) -- Amount they are affected by
	end
end))

The only reason this may not be as good as a tool because two people could run into each other and they'd both die. With a tool, it's sort of like Sword Fighting, except with your legs.

2 comments

0

Is there a pushback effect?? How would you do that as well?

0

Well you'd need to make that. It's not an event. That 'effect' is just looping the Cframe a couple of times. Need an example?

This discussion is preserved as it was. New answers, comments, and votes are closed.