#how to make a damage brick work?
1 messages · Page 1 of 1 (latest)
Your parameter name is PartB
But on line 4 you say:
local humanoid = ***hit***.Parent: FindFirstChild("Humanoid")
Change hit to your parameter name
Or change the parameter name to "hit"
Forcefield??
ah ok but the script still doesnt work is there a better script?
must i do local script in starter player or smth?
try replacing findfirstchild with waitforchild
both dont work
** You are now Level 1! **
ye u used it wrong
send it then
local damageBrick = script.Parent
damageBrick.Touched:Connect(function(hit)
local humanoid = hit.Parent:WaitForChild("Humanoid")
if humanoid then
part.CanTouch = false
task.wait(.5)
humanoid:TakeDamage(10)
task.wait(1)
part.CanTouch = true
end
end)
here is the full code
On line 1 try local damageBrick = script.Parent:Wait()
try checking if the hit is a accessory then get the player with findfirstancestor then do .humanoid
if hit:IsA("Accessory") then
humanoid = hit:FindFirstAncestorWhichIsA("Player").Humanoid
end
ok can you maybe recode if you can so i can understand?
what u tryna fix
the damage brick wont take damage at all
local damageBrick = script.Parent
damageBrick.Touched:Connect(function(hit)
local humanoid = hit.Parent:WaitForChild("Humanoid")
if humanoid then
damageBrick.CanTouch = false
task.wait(.5)
humanoid:TakeDamage(10)
task.wait(1)
damageBrick.CanTouch = true
end
end)
u stand on it for too long
Whichever works
it doesnt matter which if takedamage or humanoid.health
ah ok but how do i make it so it has to wait to damage me again if i stand on it for too long
** You are now Level 2! **
thats called a debounce
before the touched event
local damageBrick = script.Parent
local debounce = true
damageBrick.Touched:Connect(function(hit)
local humanoid = hit.Parent:WaitForChild("Humanoid")
if humanoid and debounce then
debounce = false
humanoid:TakeDamage(10)
task.wait(1)
debounce = true
end
end)
yeah
thanks so much
is it working?
yes
now i just need to make the spawn forcefield bubble shorter time limit like when you first spawn
when ur character spawns clone it and set its hrp to the new ones hrp
ah ok
maybe it will work
i will try
in spawnlocation
there is a property called duration that changes the forcefield time
This is the page to the docs if you're interested
never mind i got it working
ok
i got alot of stuff working now
keep it going, nice
yes
** You are now Level 14! **