Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

A Clone() Problem?

Asked by 10 years ago

This is the current function that i use to place my maps. How do i make it more secure? Sometimes it does not even load parts (walls) anything more secure? Or just plain efficient?

function AddField()
Fields = Game.ServerStorage.Fields
Chosen = Game.Workspace.Chosen 
Randomize = Fields:GetChildren()
Picking = Randomize[math.random(1,#Randomize)]
Chosen.Value = Picking.Name
FieldAdd = Game.ServerStorage.Fields:FindFirstChild(Chosen.Value)
FieldAdd:Clone().Parent = Game.Workspace
FieldAdd:MakeJoints()
end

3 answers

Log in to vote
3
Answered by
RM0d 305 Moderation Voter
10 years ago
function AddField()
Fields = Game.ServerStorage.Fields
Chosen = Game.Workspace.Chosen 
Randomize = Fields:GetChildren()
Picking = Randomize[math.random(1,#Randomize)]
Chosen.Value = Picking.Name
FieldAdd = Game.ServerStorage.Fields:FindFirstChild(Chosen.Value):Clone()
FieldAdd.Parent = Game.Workspace
FieldAdd:MakeJoints()
end

Try this...

0
That's the same thing though? peoplemove12 148 — 10y
0
no its not... you were adding welds to the Model in ServerStorage this Sould work TRUST me RM0d 305 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

It makes it connect to the original model so try parenting it to something like so:

function AddField()
Fields = Game.ServerStorage.Fields
Chosen = Game.Workspace.Chosen 
Randomize = Fields:GetChildren()
Picking = Randomize[math.random(1,#Randomize)]
Chosen.Value = Picking.Name
FieldAdd = Game.ServerStorage.Fields:FindFirstChild(Chosen.Value):Clone()
FieldAdd.Parent = Game.Workspace
FieldAdd:MakeJoints()
end

No I did not take other dude's I just have same answer because there isn't much more I know to clone

Log in to vote
1
Answered by 10 years ago

makeJoints()*

Answer this question