1 | 12 : 42 : 20.458 - Workspace.testModuleScript: 11 : attempt to index global 'hit' (a nil value) |
2 | 12 : 42 : 20.459 - Stack Begin |
3 | 12 : 42 : 20.460 - Script 'Workspace.testModuleScript' , Line 11 - field DoorOpen |
4 | 12 : 42 : 20.460 - Script 'Players.Player1.PlayerGui.Main_V0.03.Main_V0.03' , Line 137 |
5 | 12 : 42 : 20.460 - Stack End |
6 | Error^^ |
01 | local open = script.Parent.Parent.DoorPart.Open |
02 | local close = script.Parent.Parent.DoorPart.Closed |
03 |
04 | if close.Value = = true and open.Value = = false then |
05 | wait() |
06 | print 'Open' |
07 | testModule.DoorOpen() |
08 | else if open.Value = = true and close.Value = = false then |
09 | wait() |
10 | print 'Close' |
11 | testModule.DoorClose() |
12 | end |
13 | end |
14 | ^^^^^^Script inside the "door" |
01 | local testModule = { } |
02 |
03 | testModule.DoorOpen = function () |
04 | wait() |
05 | print "Open" |
06 | for i = 1 , 4.9 , 0.1 do |
07 | hit.Parent.DoorPart.CFrame = script.Parent.CFrame*CFrame.new( 0.2 , 0 , 0 ) |
08 | wait() |
09 | wait(WaitTime) |
10 | hit.Parent.DoorPart.Open.Value = true |
11 | end |
12 | end |
13 |
14 | testModule.DoorClose = function () |
15 | wait() |
01 | This 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 |
03 | PLR.Character [ "Torso" ] .Touched:connect( function (hit) |
04 | if hit.Name = = "DoorOpen" then |
05 | game.Players.LocalPlayer:GetMouse().KeyDown:connect( function (key) |
06 | if key = = " " then |
07 | print 'Opened Localscript' |
08 | if hit.Parent.DoorPart.Open.Value ~ = true and hit.Parent.DoorPart.Closed.Value ~ = false then |
09 | testModule.DoorOpen() |
10 | end |
11 | if key = = " " then |
12 | print 'Closed Localscript' |
13 | if hit.Parent.DoorPart.Closed.Value ~ = true and hit.Parent.DoorPart.Open.Value ~ = false then |
14 | testModule.DoorClose() |
15 | end |