Hello,
As a result, my door is not opening.
- Br, iSyriux
It probably saying that because the parent of the Model is Workspace, what are you trying to make?
Hello,
No, you totally don’t understand scripting. As you can see, it is detecting the class of the parent of the part that is inside of the table from findpartsinregion3 and I am trying to make a door that automatically opens for any humanoid that walks near it
It’s hard to understand what you’re trying to do, but because the model is in workspace it’s printing Workspace
, maybe instead do print(v.ClassName)
instead?
Hello,
It seems it does not detect the player at all anymore. I’m not sure why, but I haven’t changed anything before it broke
Hello,
Here is full script btw.
local co = false
while wait(1) do
pcall(function()
for i,v in pairs(workspace:FindPartsInRegion3(Region3.new(script.Parent.Position-Vector3.new(20,20,20),script.Parent.Position+Vector3.new(20,20,20)))) do
if v then
print(v.Name)
if v.Parent:IsA("Model") then
print(v.Parent.ClassName)
if v.Parent:FindFirstChild("HumanoidRootPart") then
print('alasa')
if (script.Parent.Position-v.Position).Magnitude<12 then
print('alas')
if co==false then
co = true
for i=1,20 do
script.Parent.Parent.R.CFrame=(script.Parent.Parent.R.CFrame+script.Parent.Parent.R.CFrame.LookVector*script.Parent.Parent.R.Size.Z/2)*CFrame.Angles(0,math.rad(-4),0)*CFrame.new(0,0,script.Parent.Parent.R.Size.Z/2)
script.Parent.Parent.L.CFrame=(script.Parent.Parent.L.CFrame-script.Parent.Parent.L.CFrame.LookVector*script.Parent.Parent.L.Size.Z/2)*CFrame.Angles(0,math.rad(4),0)*CFrame.new(0,0,-script.Parent.Parent.L.Size.Z/2)
wait()
end
wait(2)
for i=1,20 do
script.Parent.Parent.R.CFrame=(script.Parent.Parent.R.CFrame+script.Parent.Parent.R.CFrame.LookVector*script.Parent.Parent.R.Size.Z/2)*CFrame.Angles(0,math.rad(4),0)*CFrame.new(0,0,script.Parent.Parent.R.Size.Z/2)
script.Parent.Parent.L.CFrame=(script.Parent.Parent.L.CFrame-script.Parent.Parent.L.CFrame.LookVector*script.Parent.Parent.L.Size.Z/2)*CFrame.Angles(0,math.rad(-4),0)*CFrame.new(0,0,-script.Parent.Parent.L.Size.Z/2)
wait()
end
co = false
end
end
end
end
end
end
end)
end
The Workspace class inherits from the Model class, run =workspace:IsA("Model")
in the command bar and you should see true
in the console. Check ClassName
.
Oh, its you again . Is your problem that its saying v.Parent:IsA("Model")
but then it says the ClassName is Workspace?
Hello,
Also it says find parts in region 3 GET IT PARTS that means the parent has to either be a model or workspace, not workspace itself
Hello,
Yes I checked classname. Apparently it doesn’t detect the parts inside my character which is why the door isn’t opening.
Try printing v.Parent:GetChildren()
Hello,
Hey guys, sorry for the desiring faith. I discovered the issue was that the max parts was too low so I made it math.huge to fix it