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
samjay22
(Dev)
September 8, 2021, 6:10pm
#2
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
samjay22
(Dev)
September 8, 2021, 6:18pm
#4
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
samjay22
(Dev)
September 8, 2021, 6:21pm
#6
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)
samjay22
(Dev)
September 8, 2021, 6:25pm
#8
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
Konechou
(Konechou)
September 8, 2021, 6:34pm
#10
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
ItxRyland
(ItxRyland)
September 8, 2021, 6:38pm
#11
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)
ItxRyland
(ItxRyland)
September 8, 2021, 6:43pm
#13
Maybe double check you named stuff like your model correctly
bostnm
(ScriptKing)
September 8, 2021, 6:44pm
#14
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)
bostnm
(ScriptKing)
September 8, 2021, 6:50pm
#16
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
MeteorxBG
(MeteorxBG)
September 8, 2021, 6:55pm
#18
why don’t you put a script inside the nuke?
bostnm
(ScriptKing)
September 8, 2021, 6:55pm
#19
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.