Hi, i am making a vault door and a part behind it with a touch function. When the part is touched by the unanchored vault door it will trigger and error on line 13:
"Workspace.Game.Map.Stores.Bank.Vault.TakeMoneyPart.Script:13: attempt to index nil with ''FindFirstChild"
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
if hit.Parent:FindFirstChild("IsTakingMoney") and hit.Parent.IsTakingMoney.Value == false then
hit.Parent.IsTakingMoney.Value = true
end
end
end
end)
script.Parent.TouchEnded:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
if hit.Parent:FindFirstChild("IsTakingMoney") and hit.Parent.IsTakingMoney.Value == true then
hit.Parent.IsTakingMoney.Value = false
end
end
end
end)
