Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Module script help how do I fix??

Asked by 10 years ago
112:42:20.458 - Workspace.testModuleScript:11: attempt to index global 'hit' (a nil value)
212:42:20.459 - Stack Begin
312:42:20.460 - Script 'Workspace.testModuleScript', Line 11 - field DoorOpen
412:42:20.460 - Script 'Players.Player1.PlayerGui.Main_V0.03.Main_V0.03', Line 137
512:42:20.460 - Stack End
6Error^^
01local open = script.Parent.Parent.DoorPart.Open
02local close = script.Parent.Parent.DoorPart.Closed
03 
04if close.Value == true and open.Value == false then
05wait()
06print'Open'
07testModule.DoorOpen()
08else if open.Value == true and close.Value == false then
09wait()
10print'Close'
11testModule.DoorClose()
12end
13end
14^^^^^^Script inside the "door"
01local testModule = {}
02 
03testModule.DoorOpen = function()
04wait()
05print"Open"
06for i = 1, 4.9, 0.1 do
07hit.Parent.DoorPart.CFrame=script.Parent.CFrame*CFrame.new(0.2,0,0)
08wait()
09wait(WaitTime)
10hit.Parent.DoorPart.Open.Value=true
11end
12end
13 
14testModule.DoorClose = function()
15wait()
View all 29 lines...
01This is in a local script its only a bit of code, the bit that has to do with the door. its in player gui.
02 
03PLR.Character["Torso"].Touched:connect(function(hit)
04if hit.Name == "DoorOpen" then
05game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
06if key == " " then
07print'Opened Localscript'
08if hit.Parent.DoorPart.Open.Value ~= true and hit.Parent.DoorPart.Closed.Value ~= false then
09testModule.DoorOpen()
10end
11if key == " " then
12print'Closed Localscript'
13if hit.Parent.DoorPart.Closed.Value ~= true and hit.Parent.DoorPart.Open.Value ~= false then
14testModule.DoorClose()
15end
View all 23 lines...

Answer this question