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

how do you fix "attempt to index nil with 'DevEnableMouseLock'"?

Asked by 4 years ago

im trying to make shift lock not able to be turned on when player is seated because its binding over my code and i want shift lock to be able to be turned on when player is unseated

code

01local Seats = {
02    workspace["Model [2] Alpha Series of Class: Paired Dual Main Battery Station"].Seat,
03    workspace["Model [2] Bravo Series of Main Battery Class "].Seat,
04    workspace["Model [3] Charlie Series of Main Battery Class "].Seat
05}
06for i, Seat in pairs(Seats) do
07    local RemoteEvents = game.ServerStorage["Begin[N]End"]
08    local ReplicatedStorage = game:GetService("ReplicatedStorage")
09    local ServerStorage = game:GetService("ServerStorage")
10    local SeatProperty = Seat.Occupant
11 
12    Seat.Changed:Connect(function(Properties)
13        local function OnSEAT(Player)
14            if SeatProperty ~= nil then
15                RemoteEvents.Parent = ReplicatedStorage
View all 25 lines...

2 answers

Log in to vote
0
Answered by
yx10055 57
4 years ago

You did not define a player with the OnSEAT() function. You just did OnSEAT() without any porperties.

01local plr = game.Players.LocalPlayer
02local Seats = {
03    workspace["Model [2] Alpha Series of Class: Paired Dual Main Battery Station"].Seat,
04    workspace["Model [2] Bravo Series of Main Battery Class "].Seat,
05    workspace["Model [3] Charlie Series of Main Battery Class "].Seat
06}
07for i, Seat in pairs(Seats) do
08    local RemoteEvents = game.ServerStorage["Begin[N]End"]
09    local ReplicatedStorage = game:GetService("ReplicatedStorage")
10    local ServerStorage = game:GetService("ServerStorage")
11    local SeatProperty = Seat.Occupant
12 
13    Seat.Changed:Connect(function(Properties)
14        local function OnSEAT(Player)
15            if SeatProperty ~= nil then
View all 26 lines...

I'm assuming it's in a LocalScript.

0
Sorry! I meant parameters / arguments not properties. yx10055 57 — 4y
0
ohhhh you were sooo wrong i used server script it was kinda my fault proROBLOXkiller5 112 — 4y
0
dont worry i used PlayersService.PlayerAdded:Connect(function(Player) to solve the problem proROBLOXkiller5 112 — 4y
0
i didnt want exploiters to start touching those remote event proROBLOXkiller5 112 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

problem fixed

01--local Seats =
02--  {
03--      workspace["Model [A]"].Seat,
04--      workspace["Model [B]"].Seat,
05--      workspace["Model [C]"].Seat,
06--      workspace["Model [X]"].Seat,
07--      workspace["Model [Y]"].Seat    
08--  }
09 
10--local PlayersService = game:GetService("Players")
11 
12--PlayersService.PlayerAdded:Connect(function(Player)
13--  for index, Seat in pairs(Seats) do
14--      Seat.Changed:Connect(function(Property)
15--          if Seat.Occupant ~= nil then
View all 22 lines...

Answer this question