Game won't copy something from server storage and my game errors

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?

Insert Helicopter script:

game.Workspace:findFirstChild("Rescue"..script.RescueType.Value):Destroy()
Insert(fakeresc,"FakeRescue",script.HeliPos.Value)
updatefakeRescue()

Insert Function:

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

Any output errors?
What type of script are you using?

Well, I can think of two solutions.

  1. Maybe you used a local script to get the object
  2. Put it in Replicated Storage so that both the client and server can interact with it.

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.

I will try the replicated storage thing right now

oh wait btw to clone something you would use the :Clone() function

It is FindFirstChild() not findFirstChild()

hmm thats just destroying something but its freezing the script up since it will cause errors.

Can you provide an easier to read script instead of cutting bits out.

Here is the main game script Game_Main.rbxm (26.1 KB)

my roblox is acting up but did you also try to fix the other stuff we mentioned? I’m trying to open that file rn

1 Like

Yes I did, I don’t know what else to do

Oh god thats 1698 lines. In the future i would recommend you to use module scripts so its much easier to debug

1 Like

I didn’t write this, CloneTrooper1019 did and I made modifications.


–BEWARE: Large Inefficient code below.–


Lol he wrote this
anyways i dont see clone() function anywhere to copy the helicopter

1 Like

Yeah, Can you rewrite it to clone it maybe?

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.

1 Like
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

end

try printing what you cloed and see what you get

I will test this, Thank you so much.