run.Heartbeat:Connect(function()
local parts = workspace:GetPartsInPart(hitbox)
for _, part in pairs(parts) do
local parent = part.Parent
if parent and parent:FindFirstChild("Humanoid") then
if parent ~= parentModel then
parent.Humanoid:TakeDamage(damage)
end
end
end
end)
end
#hitbox getPartsinPart instantly kils people:
1 messages · Page 1 of 1 (latest)
its hitting multiple times
coz character made up of more than one part sometimes those many parts will touch the hitbox at the same time so damage will happen more than once
ye
i found out that problem too
but idk how to fix it
@raw hinge
Can i instead use a Touched
but use heartbeat
sure but you'll get the same problem
wait
how do i fix it
axeEvent.OnServerEvent:Connect(function(player)
local char = player.Character
if not char then return end
local parentModel = char
local hitbox = axeHitbox:Clone()
hitbox.Parent = workspace
local weld = Instance.new("Weld")
weld.Parent = char:FindFirstChildOfClass("Tool"):WaitForChild("Blade")
weld.Part0 = char:FindFirstChildOfClass("Tool"):WaitForChild("Blade")
weld.Part1 = hitbox
weld.C0 = CFrame.new(0, 0, 0)
weld.C1 = CFrame.new(0, 0, 0)
setupHitboxDamage(hitbox, char, 1)
game.Debris:AddItem(hitbox, 0.7)
end)
--Function for hitboxes
function setupHitboxDamage(hitbox, parentModel, damage)
local connection
connection = run.Heartbeat:Connect(function()
hitbox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(damage)
end
connection:Disconnect()
end)
end)
end
This is my new code
I just want 1 hit
but it stacks dmg
@raw hinge
Do you know the solution?
you are creating a new connection to .touched every heartbeat cmon bruh
i deleted that
bro pls help
this is my script now
@raw hinge what do you suggest
i suggest you learn the fundamentals https://create.roblox.com/docs/tutorials/fundamentals/coding-1/coding-fundamentals
and then maybe look up some tutorials
i just need the code then i learn it
lol
so if i just give you a fish will that teach you how to fish?
the docs tutorials have lots of examples bro 
bro
whatever ur thinking
I just can't think about the logic rn bro
this is what scripting help is for
i know the basics
then you're going to have a hard time learning from the example's logic 
i can't explain what im trying to do rn
ok
give me the example
ill explain that to you
then you don't know what you're doing 
and how the logic works in it
example?
Why are you in scripting help bro
they could have just told everyone to go in documentation
I have a script, and a purpose
to help people
and i want help to find out whats wrong
and to help myself along the way by learning new stuff
sometimes people ask about things im not sure about so helping them with it means i learn it too
you can fix people's code and thats better
to learn
but you tell me to go to docs
and read things i know
I just need help on what im doing rn
If we learn all the logic
anyway i told you exactly, precisely what was going wrong with your code here in my first response
you also asked about this and i told you exactly why that was happening
that is help
for any competent coder simply knowing what and why something isn't working is enough for them to fix it
i guess im not competent
bro
this is not like cheating on a test
you can give me the code
if you were wondering a pattern to solve this just put all the humanoids that have already been hit in a table so they don't get hit again kind-of like a debounce for anything that takes damage from it
i would expect even a beginner roblox scripter to know what a debounce is and how to use them https://create.roblox.com/docs/scripting/debounce
and putting them into a table shouldn't be hard
alr understood the logic now
yet what you don't understand, and arguably the most important part of scripting, is how to come up with new logic 
Exactly why he’s telling you to learn the basics