The current identity (2) cannot MakeJoints (lacking permission 1)

Hello. I made a door script for my van, which also welds boxes inside the van to the van. Here’s the script:

local button = script.Parent
local model = script.Parent.Parent
local opened = false
local function openClose(trans, cancoll, bcol)
	button.Sound:Play()
	button.BrickColor = bcol
	model.Door.Transparency = trans
	model.Door.CanCollide = cancoll
	if cancoll == true then
		workspace:MakeJoints(workspace:FindPartsInRegion3(Region3.new(model.thing1.Position, model.thing2.Position)))
	end
end
local function trigger()
	if opened == true then
		openClose(0, true, BrickColor.new("Bright red"))
		opened = false
	else
		openClose(1, false, BrickColor.new("Forest green"))
		opened = true
	end
end
button.ClickDetector.MouseClick:Connect(trigger)

But no. Life doesn’t give me lemons, and I get this in the output:

10:20:19.404 - The current identity (2) cannot MakeJoints (lacking permission 1)
10:20:19.406 - Stack Begin
10:20:19.407 - Script 'Workspace.DeliveryTruck.Button.Script', Line 10 - upvalue openClose
10:20:19.408 - Script 'Workspace.DeliveryTruck.Button.Script', Line 15
10:20:19.409 - Stack End

Is there any way to fix this?

Also, I can’t use workspace:JoinToOutsiders(), because there are some invisible triggers which will weld to the truck due to these changes.

"Don't use Surface joints, they are deprecated blah blah blah"

Pfft. If you’re telling me to use constraints instead, please close this topic. There are no auto-welding functions for WeldConstraints like MakeJoints, and they cannot be used here. Of course, I can write 50 lines long script to weld each part in the Region3 and check if this surface is able to make joints. But who needs that, when you have a simple function MakeJoints()? To be honest, I hate these moves towards constraints. They are lacking few features that old joints had, and I don’t see anything “better” in them.

1 Like

I’d hazard a guess you’re trying to MakeJoints() with a part you don’t have permission for - how I’d troubleshoot this is printing out all the parts before trying to make the joints.

if cancoll == true then
    local parts = workspace:FindPartsInRegion3(Region3.new(model.thing1.Position, model.thing2.Position))

    print('=====')
    for i,PART in pairs(parts) do
        print('Part ' .. i .. ':', PART, PART.Parent)
    end
    print('=====')

	workspace:MakeJoints(parts)
end
1 Like

Workspace.MakeJoints is restricted to plugins/command bar. Try using Model.MakeJoints instead.

2 Likes

Not really. Here’s the output I get when closing a door in an empty van:

 =====
 =====
17:24:49.051 - The current identity (2) cannot MakeJoints (lacking permission 1)
17:24:49.052 - Stack Begin
17:24:49.053 - Script 'Workspace.DeliveryTruck.Button.Script', Line 18 - upvalue openClose
17:24:49.054 - Script 'Workspace.DeliveryTruck.Button.Script', Line 23
17:24:49.054 - Stack End

Oh. But how do I use Model:MakeJoints() in this case?

Make a model, parent all your parts in it, and call the function on the new model.

Edit: Something like this:

local parts = workspace:FindPartsInRegion3(Region3.new(model.thing1.Position, model.thing2.Position))
local m = Instance.new('Model')

print('=====')
for i,PART in pairs(parts) do
     print('Part ' .. i .. ':', PART, PART.Parent)
    PART.Parent = m
end
print('=====')

m:MakeJoints()
m.Parent = --Where you want the model to end up
1 Like

No success. No objects weld to the van. I tried moving parts thing1 and thing2 so it will capture some parts of the van, still nothing welds.

One thing you could try is parenting it first, before you make the joints. I forget if :MakeJoints() requires the parent to be set or not.

m.Parent = --Where you want the model to end up
m:MakeJoints()
1 Like

I just noticed that parts don’t get put into the model. :cry:

You could try adding objects to the parts array instead. If you have the objects, just do

local parts = {}
table.insert(parts, Put part here)

:confused: I’m really bad at tables and I don’t know how that code can be used.

By the way, I somewhat fixed the issue by putting the following code into the box:

script.Parent.Touched:Connect(function(part)
	if part.Parent.Name == "DeliveryTruck" or part.Parent.Name == "SupplyTruck" then
		script.Parent:MakeJoints()
	end
end)

But it’s not the best solution, since boxes weld only after a while. If you have any better solutions, post them here!