Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

model can't be clone twice?

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)

2 comments

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.

0

I recommend using ModuleScript instead of _G, as it has some(?) vulnerabilities, but not as many, and is better to use (imo).

1 answer

✓ Accepted answer

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 :)

1 comment

0

thanks why didnt i saw that im so dumb

This discussion is preserved as it was. New answers, comments, and votes are closed.