Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

door failing to open use to work not sure why?

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

4 comments

0

Are you using R6 or R15 for players character type

0

useing r6.

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.

0

Okay, glad I could help good luck with you game :)

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.