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

Two lined search?

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?

2 answers

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

5 comments

1

Wait could I keep oing with that by doing: game.StarterPack["Redcliff Sword"].Script:Destroy() Do I need a period after ] or no?

0

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

1

I wish I could rate twice or more, because this is an excellent answer...

1

I think it's always good to remind askers of the syntactic sugar behind .. A.B is doing behind the scenes A["B"]!

0

I was not aware that was syntactic sugar! Sometimes even the knowledgable learn.

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.