Is there an alternative to touch event? Sometimes it works, and in rare cases it does not.
A skeleton of the code used.
hitbox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
-- push back
end
end)
A video portraying the problem.
Exozorcus
(Exozorcus)
September 6, 2023, 8:57am
#2
no sadly
you could try coding your own touched events but that would be tedious
it could be something to do with how youre positioned, try making a bigger hitbox infront of you
You will need to use GetPartsInPart, as part.Touched isn’t really efficient
while true do
wait(0.1)
local touchingParts = game.Workspace:GetPartsInPart(hitbox)
for i,v in pairs(touchingParts) do
if v.Parent:FindFirstChild("Humanoid") then
push back
break
end
end
end
1 Like
Exozorcus
(Exozorcus)
September 6, 2023, 10:44am
#5
doesnt Touched just return a callback when GetPartsInPart changes??
1 Like
Oops I forgot to put it in a loop, thanks for letting me know though
Exozorcus
(Exozorcus)
September 6, 2023, 10:48am
#7
no i have no idea im asking you
What do you mean by that, I don’t understand what you’re trying to ask
Exozorcus
(Exozorcus)
September 6, 2023, 10:56am
#9
does touched fire when gettourchingparts or getpartsinpart changes?
FP_Nation
(FP_Nation)
September 6, 2023, 11:21am
#10
Touched events are unreliable.
You alternatives are WorldRoot:GetPartBoundsInBox(), WorldRoot:GetPartBoundsInRadius(), WorldRoot:GetPartsInPart(), or any other custom function that works with all the 4 points of a part, and checks their positions.
1 Like
No, they work on completely different mechanics
xvywop
(ChaseAtlantic)
September 6, 2023, 11:31am
#12
Why dont you use alternatives like raycast, region, hitbox/zone
– Hitbox
Are you tired of using .touched hitboxes, constantly not working? Well, Hitbox Service may be the module for you!
Download here: Hitbox Service - Roblox
As you can see, I made a hitbox which would damage the player
Source Code:
Source Code -- biack1st
--[[
HELLO!! thank you SO much for downloading this module!!! In order to use this module please look at the devforum post:
]]--
local module = {}
local RunService = game:GetService("RunService")
module.__index = module…
– Zone
I have a bug where i’m inside a zone and when i run into random parts inside of that zone then sometimes it registers that i’ve left the zone… does anyone have a fix for this?
– TouchedPlus (That could could really help you lol)
TouchedPlus
Raycast Based Collision Detection For Cuboids
Robloxs Built in Touched & TouchEnded events are sensitive and near unusuable. I haven’t since found a good, fast and performant alternative to this - so decided to make one. Even Zone+ has limitations as it uses Region3 which is more costly than raycasting. I also wanted to offer much more control to the developer to decide the balance on accuracy, speed and performance.
[Example GIF]
So without further ado, here is “TouchedPlus”, na…
– Raycast (Melees)
Current Version: V.4.01 Stable (09/21/2021)
Upgrading from 3.xx to 4.0
Please note that V4 is not backwards compatible with V3. There are a few API changes that were introduced in V4 to better suit modern code etiquette. Here are the changes you need to know if you want to make your code compliant with V4:
Raycast Hitbox 4.01: For all your melee needs! - #597 by TeamSwordphin
Notable Features
Accurate, performant , and easy to use!
Use attachments or vectors to make your hitboxes in secon…
2 Likes
system
(system)
Closed
September 20, 2023, 11:31am
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.