#Problem basic script

1 messages · Page 1 of 1 (latest)

night hazel
#

Im a new at scripter, why when the hitbox touch the part i dont dead

summer cloud
#

Your "character" value isn't referencing the character I believe

cedar stream
night hazel
night hazel
cedar stream
jolly ploverBOT
#

studio** You are now Level 1! **studio

cedar stream
night hazel
#

yeah its real

#

im confused to how i can do

raven laurel
#

character = hit.Parent

#

and make sure its a character by doing if character:FindFirstChildOfClass("Humanoid") then

night hazel
#

Okey ty

night hazel
#

i think character is not hit.parent

#

or idk

raven laurel
#

are you trying to make it only function if the hit part is the part variable

#

you can only get the character if its the character thats touching the part

#

it doesnt work because youre making sure hit == part

night hazel
raven laurel
#

do you want everyone to die or a specific guy to die

jolly ploverBOT
#

studio** You are now Level 1! **studio

night hazel
#

lmao u join the game, ur hitbox touch the part, u die

#

just that

raven laurel
#

because youll have to loop through game.Players and kill them by player.Character

#

so if hit == part then

for v, playas in ipairs(game.Players:GetPlayers()) do playas.Character.Humanoid.Health = 0 end

night hazel
#

im cooked

#

IT WORK

#

TY

#

So much

raven laurel
#

no problem yo

clear sage
#

i think because you put lafoction

frosty narwhal
#

roblox handles it already

#

so you can just for _, item in table do

last pine
#

Wait but doesn't ipairs make it so that it goes through everything in order?

#

Or does it automatically do that now?

night hazel
jolly ploverBOT
#

studio** You are now Level 2! **studio

night hazel
#

thats not hit.parent

#

but mine was hitbox.parent

#

local hitbox = script.Parent
local part = workspace.tueur

hitbox.Touched:Connect(function(hit)
if hit == part then
local character = hitbox.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0
end
end

end)