I have been Working on something and I have been having this error where some tools trigger this touch event but others do sometimes but not all the time
Code
script.Parent.Touched:Connect(function(hit)
print("TOUCHED")
print(hit)
local hum = Part.Parent:FindFirstChild("Humanoid")
if hum then
local tool = hum.Parent:FindFirstChildOfClass("Tool")
if tool then
hit = tool.Handle
print(hit)
end
end
if Part.Parent:FindFirstChild("Variable1") and script.Parent.Parent.exp ~= 0 and hit.Parent.Click.Variable2.Value == true and Part.Parent:FindFirstChild("Variable3") then
print("Test")
if hit.Parent.Variable3.Value then
stuff
else
warn("Error Has Occurred")
end
end
end)
If have noticed that it stops when it gets to this line (By the Error Raised)
if hit.Parent.Variable3.Value then
I don’t see why it wont work since all the tools have a Variable3 Bool Value
Thanks!