You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve?
I want to make sure that players only take damage when they actually touch the rolling log. If they jump over it or are not in direct contact, they should not take damage.
- What is the issue?
(The red part is the Hitbox.)
Right now, players take damage even when they are not touching the log. If they jump and the log rolls underneath them, they still take damage, even though there is no actual contact.
- What solution have you tried so far?
• Used a Hitbox part instead of detecting collisions on the entire log.
• I tried to look for alternatives on the DevForum, but I didn’t understand most of them as I’m still learning and an intermediate scripter
local logDamage = 5
local logDamageDebounce = .25
local debounce = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not debounce then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr.Character.Humanoid:TakeDamage(logDamage)
print("Plr took damage")
task.wait(logDamageDebounce)
debounce = false
end
end)