How do I make so this part, which I can move manually, detects when another part touches it

Only help if you’ve got time!

I’ve been trying to make kindoff a Hitbox, that moves with the part that the player controls,
I’ve tried to make so when that Hitbox touches a part, something happens. But I’ve never got it to detect when it touches.

No errors. https://twitter.com/Sp0ngebobplays/status/1426834666791780353

  1. I’ve been looking at Region3 Tutorials on YT and Dev Hub, Other tutorials and going through the script.
    I’ve tried it without the while true do loop in the beginning but that also doesnt work.
while true do
	wait()
	local regionpart = game.Workspace.TurningHitBox
	local pos1 = regionpart.Position - (regionpart.Size / 2)
	local pos2 = regionpart.Position + (regionpart.Size / 2)
	local region = Region3.new(pos1, pos2)
	
	
	while true do
		wait()
		local partsInRegion = workspace:FindPartsInRegion3(region, regionpart, 275)
		for i, regionpart in pairs(partsInRegion) do
			if regionpart.Parent:FindFirstChild("Part") then
				print("Turning available")
				wait(.5)
			else
				print("Turning not available")
				wait(.5)
			end
		end
	end
end

Only help if you’ve got time! :slight_smile:

How about raycasting? You can fire 4 short rays every frame (possibly in a LocalScript so you don’t stress the server), one on the left, one on the right, one in front and one one the back of the part, and check if one of them find a part.

2 Likes

Yeah Imma try! Thanks! I’ll update if I get any errors.

Can’t you just use :GetTouchingParts()
you can call :GetTouchingParts() whenever your hitbox is .Touched()

1 Like

Couldn’t get it to work, the Ray to work.