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

model can't be clone twice?

Asked by
npott13 23
7 years ago

I got a model inside replicatedstorage with stringvalue OwnerName and i got a gui whenever you click it it clones the model to workspace and it works fine.. but whenever i click the gui to clone again it says that 03:32:26.334 - OwnerName is not a valid member of Model , but i checked the replicatedstorage the model is still there and the OwnerName value.

a = game.ReplicatedStorage.WindTurbine:clone() 



script.Parent.MouseButton1Click:connect(function()
a.OwnerName.Name = script.Parent.Parent.Parent.Parent.Parent.Parent.Name
a.Parent = game.Workspace

a:MakeJoints()  

_G.down = true --- these two is for another script
_G.target = a

end)
0
I recommend against using "_G" as it has security vulnerabilities. i.e. someone found the name that _G connects do, and is able to access that data, from any script, regardless of where the original is located. TheeDeathCaster 2368 — 7y
0
I recommend using ModuleScript instead of _G, as it has some(?) vulnerabilities, but not as many, and is better to use (imo). TheeDeathCaster 2368 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

I see your issue. You see, you're only actually cloning the model once. Here's your script fixed:

-- Before you had the clone line up here. That only clones it one time.

script.Parent.MouseButton1Click:connect(function()
a = game.ReplicatedStorage.WindTurbine:clone() -- You need to clone every time the button is pressed.
a.OwnerName.Name = script.Parent.Parent.Parent.Parent.Parent.Parent.Name
a.Parent = game.Workspace

a:MakeJoints()  

_G.down = true --- these two is for another script
_G.target = a

end)

Hope I helped :)

0
thanks why didnt i saw that im so dumb npott13 23 — 7y
Ad

Answer this question