Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to trigger touch event when its between 2 iddle anchored parts?

One scenario is:

Scripting a punch, making it so when a plr clicks "q" i spawn in front of him an invisible box (representing the hit-box) that will destroy anything it touchs. When Spawning the box i do clone, anchored = true, parent = workspace, cframe = ... Then i want it to be able to detect anything that is touching the box and destroy it.

Problem: The touch event isnt triggered bec neither the box nor other parts are moving bec they are things like walls and stuff anchored.

How to solve this?

4 comments

0

Use raycasting for the punch

0

Raycasting is just one line, i need it to be space

0

Try a Region3

0

Region3 has 2 problems i belive: first is it can only work as a cube, and second is you cant rotate the "cube" region, it consideres a cube according to world coordinates

1 answer

part = script.Parent
part.Touched:Connect(function()
	if part:FindFirstChild("Humanoid") then
		-- Code Here
	end
	if not part:FindFirstChild("Humanoid") then break
end)

2 comments

0

I haven't been on this site in a while, so I could be rusty. But that should be right if you don't want to detect those anchored parts.

0

Not asking how to use the touch event.. But thx for the effort

This discussion is preserved as it was. New answers, comments, and votes are closed.