12:42:20.458 - Workspace.testModuleScript:11: attempt to index global 'hit' (a nil value)
12:42:20.459 - Stack Begin
12:42:20.460 - Script 'Workspace.testModuleScript', Line 11 - field DoorOpen
12:42:20.460 - Script 'Players.Player1.PlayerGui.Main_V0.03.Main_V0.03', Line 137
12:42:20.460 - Stack End
^^^^^^^^^^^^^^^^^^Error^^^^^^^^^^
local open = script.Parent.Parent.DoorPart.Open
local close = script.Parent.Parent.DoorPart.Closed
if close.Value == true and open.Value == false then
wait()
print'Open'
testModule.DoorOpen()
else if open.Value == true and close.Value == false then
wait()
print'Close'
testModule.DoorClose()
end
end
^^^^^^^^^^^^^script^^^^^^^^^^^^^^^^
local testModule = {}
testModule.DoorOpen = function()
wait()
print"Open"
for i = 1, 4.9, 0.1 do
hit.Parent.DoorPart.CFrame=script.Parent.CFrame*CFrame.new(0.2,0,0)
wait()
wait(WaitTime)
hit.Parent.DoorPart.Open.Value=true
end
end
testModule.DoorClose = function()
wait()
print'Close Function ran'
for i = 1, 4.9, 0.1 do
script.Parent.CFrame=script.Parent.CFrame*CFrame.new(-0.2,0,0)
wait()
wait(WaitTime)
hit.Parent.Parent.DoorPart.Open.Value=false
hit.Parent.Parent.DoorPart.Closed.Value=true
hit.Parent.DoorPart.Closed.Value=true
wait()
end
end
return testModule
^^^^^^^^^^^^^^^^^^^^^^^^^Module script^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|