Alternative for .Touched event

I made some blocks that give players a boost using the .Touched event. But it is not reliable(for example, I can walk on blocks and it doesn’t give me any effects). Is there any other way?

(I don’t want to use Region3 cause there are a lot of blocks.)

I think you need to be a bit more specific on what you are trying to achieve.
And possibily some information and screen-shots of what you want.

maybe you are using the event wrong?
or perhaps it’s running infinite amount of times?

You could use the touchingPart or humanoidPart

1 Like

Sometimes, the .Touched event don’t work probably. For example, I could walk on the block and it wouldn’t give me any effects

Are you detecting your character properly?
maybe it’s detecting a part other than your character.

Yes, I am. I used an if statement to check if that is a player.

How to use them? I haven’t heard of that before.

Are you using it as:

-- Touch event
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then

GetTouchingParts() basically returns an array of all the parts its touching.

Note - Both part must be canCollided

Also you can use a combination of

.Touched and .TouchEnded

(30 chars is amazing. Thanks Roblox.)

I thought about the combination but yet again, I can still walk on blocks and don’t have any effects.

Can you post your script please?

	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		hit.Parent.Humanoid.Health = 0

This might help you out:

It uses a combination of Region3 and Raycasting to check when a player enters a ‘zone’.

Simply do:

local touchParts =
local zone =
	-- give boost
	-- remove boost

Thats pretty weird, I just tested it and it worked. Are you sure this code is inside a server script?

1 Like

my advice is to look into Region3 it requires a little more work but it runs very well for me and almost no lag.

1 Like

You can use .Magnitude, the distance in studs between 2 objects, or :GetToucingParts(), which returns an array on the parts that intersect with the part.


Can I group all the blocks to do that or I have to do it for every single blocks?