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

door failing to open use to work not sure why?

Asked by 5 years ago

I use to use this door for a old group game. but the script wont open the door and keeps popping out a error on me not sure what's going on here.

error is,

Workspace.Model.DOOR.Model.Door.Detector.detect:10: attempt to index field 'Character' (a nil value)

local distance = 14
local width = 6


local check = 0
local open = false

while true do
    for k,v in pairs(game.Players:GetChildren()) do
        if (script.Parent.Position - v.Character.Torso.Position).magnitude < distance then
            check = check + 1
        end
    end
    if check >= 1 then
        if open == false then
            open = true
            for i = 0,width*2 do
                for a,b in pairs(script.Parent.Parent:GetChildren()) do
                    if b.Name == "b1" then
                        b.CFrame = b.CFrame * CFrame.new(0,0,-0.5)
                        else if b.Name == "a1" then
                            b.CFrame = b.CFrame * CFrame.new(0.5,0,0)
                            else if b.Name == "c1" then
                                b.CFrame = b.CFrame * CFrame.new(0,0,0.5)
                            end
                        end
                    end
                end
                wait(0.05)
            end
        end
        else if check == 0 then
            if open == true then
                open = false
                for i = 0,width*2 do
                    for a,b in pairs(script.Parent.Parent:GetChildren()) do
                        if b.Name == "b1" then
                            b.CFrame = b.CFrame * CFrame.new(0,0,0.5)
                            else if b.Name == "a1" then
                                b.CFrame = b.CFrame * CFrame.new(-0.5,0,0)
                                else if b.Name == "c1" then
                                    b.CFrame = b.CFrame * CFrame.new(0,0,-0.5)
                                end
                            end
                        end
                    end
                    wait()
                end
            end
        end
    end
    check = 0 
    wait()
end
0
Are you using R6 or R15 for players character type Vxpper 101 — 5y
0
useing r6. BinarySolo 7 — 5y
0
oh wow, ok i just checked. the game settings i had it set to player choice. once i changed it to r6 it fixed my issue. BinarySolo 7 — 5y
0
Okay, glad I could help good luck with you game :) Vxpper 101 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

fixed by setting the game settings to r6, thanks to vxpper, for a asking me if I was using r6 are r15 had the game set to player choice, once I changed it to r6 the issue was solved.

Ad

Answer this question