#how do i hit multiple humanoids in 1 hitbox?
27 messages · Page 1 of 1 (latest)
Send a smaller portion of the script that just handles the detecting of humanoids?
either that or just use https://pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
hitbox4.Touched:Connect(function(hit)
if hit.Parent.Name ~= plr.Name and hit.Parent:FindFirstChild("Humanoid") then
if hitboxcooldown == true then return end
hitboxcooldown = true
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(35)
it looks like the hitboxcooldown is going to be set when one thing touches it, so any other things touching it won't get detected.
Instead, make that cooldown humanoid specific by using a table, like cooldowns[humanoid] = true and check for cooldowns[humanoid]. Used tables like that before?
no i havent used tables
so i should replace the hitboxcooldown with cooldowns[humanoid] = true?
Well not that exactly
First you need to make a table that'll hold these.
local cooldowns = {} outside of the touched event.
Then, when you want to set the cooldown, you'd do cooldowns[humanoid] = true or false, where "humanoid" is the humanoid that touched.
When you need to check if the cooldown is true or false, you'd do if cooldowns[humanoid] then
okay let me try
local cooldowns = {}
hitbox4.Touched:Connect(function(hit)
if hit.Parent.Name ~= plr.Name and hit.Parent:FindFirstChild("Humanoid") then
cooldowns["Humanoid"] = true
if cooldowns == true then return end
task.wait(2.5)
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
so this should work?
now they die instantly
You used the string, or word, "Humanoid". That does not work, as that's the same for every touch event, and you didn't adjust the check for seeing if the cooldown was active
You need to save the humanoid you find from FindFirstChild into a variable first, then use that in cooldowns
how can i do that?
I told you
im sorry but i really dont know what to do
what is confusing you specifically
how i can safe a humanoid, is it just ''local hitplayer = hit.parent"?
** You are now Level 3! **
Right way wrong information
You get the humanoid by doing hit.Parent:FindFirstChild("Humanoid"), so that's what you'd save
and hit.Parent isn't necessarily a player.
If you don't want to save it in a variable then use it, you can just reuse that FindFirstChild
I'm trying not to just give away a script, but you were meant to do cooldowns[hit.Parent:FindFirstChild("Humanoid")]
thank you but im really new in scripting so i dont understand what all those """and {} [] mean
I think then it's more important you learn some programming fundamentals