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.
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
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
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!