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.
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.
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
7 comments
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 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
e.g distance from characters
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 NOT if this is a server script, which in most cases will be
and if the player is tping themselves then it might be best to implement something to stop that directly
yeh you need remote events