You misspelled FindFirstChild.
with or without the debounce, the player still takes damage, even if the value is set to false. And the issue is still the same
Check my code, I even made a video showcasing it.
it didnt work before you edited it, let me try it out!
Also, remember that you have to change the local value = true
so that it works.
yeah i just noticed it, thanks!
Just do “if value then” not “if value == true”
That isn’t what he’s looking for.
Try using ZonePlus by the HD Admin dude.
You don’t need ZonePlus for this simple of a script.
He should follow the devforum rules more clearly so people don’t get confused about what he needs
you simply didnt read the description well
the damage being dealt more than once had to do with my script (which isnt inside the part) if it worked for you. so i moved it to the part, and it still does the same thing
also in these lines
local value = false
if hit.Parent:FindFirstChild("Humanoid") then -- checks if its a character
if hit.Parent.Name == name then -- checks if the character's name matches up with the name earlier
if value == true then
I never set the value to true, yet it still activated?
Sorry you have no respect (something you can learn). I have supported you and your script as this is scripting support. I fixed an issue I saw and you didn’t therefore you should show even more gratitude. I hope for your sake that you did not mean impertinence in that message
Can you send me the whole code that you copied? because that is not supposed to happen.
i meant no offence with what i said, i thought you were replying to this part.Touched triggering - #9 by Katrist
I double checked and you were not, Sorry ;/
script.Parent.Touched:Connect(function(hit)
local name = hit.Parent.Name
local value = false
if hit.Parent:FindFirstChild("Humanoid") then -- checks if its a character
if hit.Parent.Name == name then -- checks if the character's name matches up with the name earlier
if value == true then
print("a") -- for bug testing
hit.Parent.Humanoid:TakeDamage(20) -- deals damage
script.Parent:Destroy() -- destroys part
end
end
end
end)
i confused a few things, it seems to be working properly now. i appreciate your help!
local part = workspace.Part
local debounce = false
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if debounce then
return
end
debounce = true
humanoid:TakeDamage(20)
task.wait(0.25)
part:Destroy()
debounce = false
end
end)