What do you want to achieve? Keep it simple and clear!
I want to make it so you can weld the contents of any model to a part inside of that model except the part being welded to
What is the issue? Include screenshots / videos if possible!
Module script:
local Functions = {}
Functions.WeldModelToPart = function(Model,Part)
for _,v in pairs(Model:GetChildren()) do
if v:IsA("BasePart") and not (Part) then
local WeldConstraint = Instance.new("WeldConstraint")
WeldConstraint.Part0 = v
WeldConstraint.Part1 = Part
WeldConstraint.Parent = WeldConstraint.Part0
v.Anchored = false
end
end
end
return Functions
Function that calls it:
local Mainsystem = require(game.ServerScriptService.MainsystemBase)
wait(1)
spawn(Mainsystem.WeldModelToPart)(workspace.CoreFolder.ControlRoomGlassCover.Door1,workspace.CoreFolder.ControlRoomGlassCover.Door1.Primary)
The error is:
20:47:17.829 ServerScriptService.MainsystemBase:6: attempt to index nil with 'GetChildren' - Server - MainsystemBase:6
Not sure why this is happening, But all locations are correct
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes actually, but none of them seemed to work
The error message does not change your incorrect function syntax; spawn a new function, then call the weld function inside that newly spawned function.