Local Touched event not working?

Hello! I have no idea why… but i’m trying to call a simple on touched event locally, but it will not work. Anyone have any idea why?

It depends on where your local script is located, local scripts do not run in workspace unless it is in the player character. You should check in this link to see where to put your script.

1 Like

I also tried to put it through the server just in case… and it didnt work.

function BreakWall(touched)
print("Wall Touched", touched.Name)
local Wall = script.Parent.Parent
local BrokenWall = Wall:WaitForChild("BrokenWall")

if touched.Name == "MagicSpell" and touched:FindFirstChild("SpellName") and touched:FindFirstChild("SpellName").Value == "Orlora" then
	BrokenWall.Transparency = 1
	script.Parent.CanCollide = false
	Wall:WaitForChild("Broken").Value = true
	for i,v in pairs(Wall:GetChildren()) do
		if v:IsA'BasePart' and v.Name == "Brick" then
			v.Anchored = false				
		end
	end
end
end

script.Parent.Touched:Connect(BreakWall)

Is it printing anything here? If so, what?

I’m just asking for it to tell me that it made it into the function for testing.

Yes but did it get to that point in the script? What did it print?

All that might need to be indented.

Additionally, put in print(“First”) and print(“Second”) etc after every “If” statement to make sure it’s getting past it.

Additionally, print out the criteria for it to be true, before the if statement so that you can check which values are are set to before the if Statement reads them.