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

Best hitbox and damage method for a punch script?

Asked by
Jirozu 71
4 years ago
Edited 4 years ago

Whats the best method to make a networked combat/punch script do damage? Is it magnitude, raycast, or just using a simple touch event?

A little example would also be helpful, after that i can take it from there. Please and thank you.

1 answer

Log in to vote
1
Answered by
DanzLua 2879 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Touched event and getting a character from the hit would be best

local hitter=--maybe your arm/hand or a tool
local hitting=false

--change hitting when your doing an action

hitter.Touched:Connect(function(hit)
    if hitting then
        if hit.Parent:FindFirstChild("Humanoid")~=nil then
            hit.Parent.Humanoid:TakeDamage(10)
        end
    end
end)
0
Isn't this really bad? I mean as a exploiter. You could just teleport a part of the enemy or whatever and hit it from a position it is not. aiza_teizuki 15 — 4y
0
@aiza_teizuki no, you lose out on performance by doing it more complexly to combat exploiting, but no one is stopping you from creating OTHER scripts or MODIFY this one just a bit to combat things like this DanzLua 2879 — 4y
0
e.g distance from characters DanzLua 2879 — 4y
0
Yeah I get that, But I just meant in general. Not having that distance check could allow some people to easily break a entire lobby. ( If we are talking about a rpg styled game ). aiza_teizuki 15 — 4y
View all comments (3 more)
0
@aiza_teizuki NOT if this is a server script, which in most cases will be DanzLua 2879 — 4y
0
and if the player is tping themselves then it might be best to implement something to stop that directly DanzLua 2879 — 4y
0
yeh you need remote events sen_trix 31 — 4y
Ad

Answer this question