So I have been scripting quite a while now when I came across a problem, I cannot access a two lined name. Such as a weapon named Redcliff Sword. How would you access that simply like using
game.StarterPack.Redcliff Sword:clone()
Any help?
So I have been scripting quite a while now when I came across a problem, I cannot access a two lined name. Such as a weapon named Redcliff Sword. How would you access that simply like using
game.StarterPack.Redcliff Sword:clone()
Any help?
It's very simple.
game.StarterPack["Redcliff Sword"]:Clone() --Notice the lack of a period after 'StarterPack'
Or, alternatively, if you're not certain it exists:
game.StarterPack:FindFirstChild("Redcliff Sword"):Clone()
s = game.StarterPack["Redcliff Sword"]:clone()
s.Parent = --Wherever you want to put it.
This discussion is preserved as it was. New answers, comments, and votes are closed.
5 comments
Wait could I keep oing with that by doing: game.StarterPack["Redcliff Sword"].Script:Destroy() Do I need a period after ] or no?
That line is correct. You can use this method wherever you would use a period: Workspace["Object 1"]["Child 6"].Period["Stoof Bloof"]:Clone().Parent = Workspace
I wish I could rate twice or more, because this is an excellent answer...
I think it's always good to remind askers of the syntactic sugar behind
.. A.B is doing behind the scenes A["B"]!I was not aware that was syntactic sugar! Sometimes even the knowledgable learn.