I was fixing Kool Killer early 2013 version and across the way, I came across a bug where it would have to insert a helicopter from insert service, but I rescripted my insert function instead of using insert service to copy and duplicate it into my workspace from Server Storage. My function didn’t work and the helicopter wasn’t copied. How can I fix this?
function Insert(ID,name,pos)
local Model = LoadAsset(ID)
Model.Parent = game.Workspace
Model.Name = name
Model:MakeJoints()
if Model:FindFirstChildOfClass("Model") then
if Model:FindFirstChildOfClass("Model"):FindFirstChild("Engine") then
Model:FindFirstChildOfClass("Model"):FindFirstChild("Engine"):FindFirstChildOfClass("BodyPosition").D = 15000
end
if Model:FindFirstChildOfClass("Model"):FindFirstChild("Colors") then
if Model:FindFirstChildOfClass("Model"):FindFirstChild("Colors"):IsA("Script") then
Model:FindFirstChildOfClass("Model"):FindFirstChild("Colors").Disabled = true
end
end
end
if pos ~= nil then
Model:MoveTo(pos)
end
end
Load Asset Function:
local function LoadAsset(id) local model = game:GetService("ServerStorage").Inserts[tostring(id)]:Clone() model.Name = "Model" return model end
The folder in server storage contains the models and the model names for them are their original asset id
Regular script, all the functions are in the same script as the one that copies the helicopter. And no, there are no output errors but CloneTrooper1019 coded Kool Killer with an error script so if something doesn’t load it says there is an error.
Hmm when he made this function he actually didn’t want to clone a helicopter but more like he wanted to reset the damaged helicopter or something. Ill come up with something real quick.
function Insert(ID,name,pos)
local Model = LoadAsset(ID)
local newModel = Model.Clone()
newModel.Parent = workspace
newModel.name = name
newModel.Position = pos
-- or newModel.PrimaryPart = pos
--stuff below is old code
Model.Parent = game.Workspace
Model.Name = name
Model:MakeJoints()
if Model:FindFirstChildOfClass("Model") then
if Model:FindFirstChildOfClass("Model"):FindFirstChild("Engine") then
Model:FindFirstChildOfClass("Model"):FindFirstChild("Engine"):FindFirstChildOfClass("BodyPosition").D = 15000
end
if Model:FindFirstChildOfClass("Model"):FindFirstChild("Colors") then
if Model:FindFirstChildOfClass("Model"):FindFirstChild("Colors"):IsA("Script") then
Model:FindFirstChildOfClass("Model"):FindFirstChild("Colors").Disabled = true
end
end
end
if pos ~= nil then
Model:MoveTo(pos)
end