Detecting if Nuke is touching the baseplate

How do I check if the Nuke is touching the baseplate?

local G
	G = Baseplate.Touched:Connect(function()
		for _,v in pairs(Baseplate:GetTouchingParts()) do
			if v:IsA("MeshPart") and v.Name == "Nuke" then
				print("Nuke is touching baseplate!")
			end
		end
	end)

there is no errors in the output is just not detecting Nuke is touching the baseplate

1 Like

Is there an error or what? I cant just magically find the issue.

there is no errors in the output is just not detecting and printing Nuke is touching the baseplate

Okay, the RBXScriptSignal touched returns the instance that was touching. You don’t need to use a for loop.

G = Baseplate.Touched:Connect(function(Instance)
if Instance.Name == "Nuke" then
end
 end)

umm… is not outputting anything tho

	G = Baseplate.Touched:Connect(function()
		if Instance.Name == "Nuke" then
			print("Nuke is touching the baseplate!")
		end
	end)
end)

that you see is from the localscript checking if the player press is the owner
image

Your code is not the same as mine.

Oh, mb it still doesn’t seems to work tho

G = Baseplate.Touched:Connect(function(Instance)
		if Instance.Name == "Nuke" then
			print("Nuke is touching the baseplate!")
		end
	end)

Hmm, that is rather strange. Move the part around to see if it triggers that way. Then try and remove the conditional to see if the event is fired at all.

I have tried both your methods they don’t work

Maybe because the script is trying to look for a part in the “Nuke” model named “Nuke”. Maybe try this?

if Instance.Parent == "Nuke" then
--thing
end

I think it should be that, but with this small change:

if Instance.Parent.Name == "Nuke" then
 print("Nuke has touched the ground")
 --Do your boom boom stuff here
end

That is really strange it still doesn’t detects the nuke when the it touches the baseplate tho

G = Baseplate.Touched:Connect(function(Instance)
		if Instance.Parent.Name == "Nuke" then
			print("Nuke is touching the baseplate!")
		end
	end)

Maybe double check you named stuff like your model correctly

Have you tried using the touch event on the nuke instead of the baseplate? Then check if it’s the baseplate.

Nuke.Touched:connect(function(hit)
If hit.Name == “baseplate” then
print(“touched”)
end
end)

I have tried it and still no result

G = Nuke.Touched:Connect(function(hit)
		if hit.Name == "Baseplate" then
			print("Nuke is touching the baseplate!")
		end
	end)

Why do you have the event equal to “G”?

I have that so when it touches the baseplate it will disconnect the Nuke and destroy it so the Nuke doesn’t create shockwave multiple times

why don’t you put a script inside the nuke?

Could you make a bool value instead and make the nuke check if that is true to explode, and set it to false when it touched baseplate. Because I don’t see anything wrong with the touch event.

Try printing something on each line to see where it gets stuck. It might be that the script is disabled.