Nothing erroring?

  1. What do you want to achieve?
    I’m making a disaster game that checks first if a part is destructable, then unanchors the part if it is. (in this instance a part checks for all the parts insides it and unanchors accordingly)

  2. What is the issue? Include screenshots / videos if possible!
    This script was working a second ago, but it suddenly stopped after I added the extra elseif statements, and the parts arent unanchoring. Every print except the print in the second line in the code doesnt show, and no warnings or errors pop up in the output menu.

Here is the code:

RunService.Heartbeat:Connect(function()
	print("is this thing even on") --the only thing that actually shows up in output
	local EffectZone = KILL:GetTouchingParts()
	for i, part in EffectZone do
		print("Part Detected")
		if CollectionService:HasTag(part, "Destructable") then
			print("Part is Destructable")
			if CollectionService:HasTag(part, "Strength4") then
					part.Anchored = false
			elseif CollectionService:HasTag(part, "Strength3") then
					part.Anchored = false
			elseif CollectionService:HasTag(part, "Strength2") then
				part.Anchored = false
			else 
				CollectionService:HasTag(part, "Strength1") 
				part.Anchored = false
			end
		end
	end
end)

Are you sure that parts are indeed touching the zone?

I’m unable to send a video at the moment but the zone (red semi-transparent block) tweens and passes over everything in this image, and nothing shows up in the output the entire time.

Somewhere win the script, can you please chuck this line of code in:

KILL.Touched:Connect(function()print("Touched")end)

This actually fixed it! I’m wondering what I did wrong though before, as I can’t really tell what this code is fixing

Nevermind, I searched it up a little and found that you need to create a touch interest on a part with canCollide off for GetTouchingParts to work.

Honestly didn’t expect my debug thing to fix it, but hey, it worked anyway xD

1 Like