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

Error code. How to solve?

Asked by 5 years ago
Edited by Shawnyg 5 years ago

Error:

Config is not a valid member of Part

The script itself:

local UserInputService = game:GetService("UserInputService")
local PlayerService = game:GetService('Players')
local Player = PlayerService.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local PressE = game.Workspace.ModelDoor.Door.PressE.BillboardGui
Center = game.Workspace.ModelDoor.Door.Center
Config = game.Workspace.ModelDoor.Door.Config
local DB = 1
Mouse = game.Players.LocalPlayer:GetMouse()
local Open = false
Medium = game.Workspace.Medium
local Activ = false
local Obj = nil
UserInputService.InputBegan:Connect(function(Input)
    if Activ and Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == Enum.KeyCode.E then
        Obj.Config.DetectEvent:FireServer() ---------------------Error here
    end
end)
while wait() do
    Obj = nil
    Activ = false
    for _, ModelDoor in pairs(workspace.ModelDoor.Door:GetChildren()) do
        local mag = (Character.HumanoidRootPart.Position - Center.Position).magnitude
        if mag <= Config.Range.Value then
            Activ = true
            Obj = ModelDoor
            PressE.Enabled = true

        end
        end
end
0
Expain what you are doing with this code User#5423 17 — 5y
0
In the sense of? BITCr8ator -11 — 5y
0
in the sence of what you want this code to do and background information which would help us understand how to help you User#5423 17 — 5y
0
there's simply no obj in that part that is named config. CjayPlyz 643 — 5y
View all comments (2 more)
0
just some tips to make things look cleaner: when you're defining variables as nil or false just write 'local VariableName', and it will set the value to nil/false. Use workspace to reference workspace as well. Sublivion 1 — 5y
0
Edit: Removed unnecessary characters from the title Shawnyg 4330 — 5y

Answer this question