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

Help, line of code may be incorrect // I'm doing it wrong?

			wait(.5)
			Instance.new("Part",game.Workspace.Fires).Name = player.Name.."'s fire"
			local Fire = game.Workspace.Fires."player.Name."'s fire"

So this script is suppose to create a brick, name the brick after the player who created it + 's fire, then make a variable named Fire of that brick. It'm not really sure how to code the 3rd line, any help??

2 answers

✓ Accepted answer

You can use brackets to search for a child via a string;

workspace.Fires[player.Name.."'s fire"]

This works the same way as a dot, it just allows strings, numbers, etc.


It would probably be better, however, to just define the variable when you create the part, just to make extra sure you get the correct one.

local Fire = Instance.new("Part", workspace.Fires)
Fire.Name = player.Name.."'s fire"

If you predefine the object you created before, it would be easier to access it. Assuming you defined "player"

wait(0.5)
local Fire = Instance.new("Part", game.Workspace.Fires)
Fire.Name = player.Name.."'s fire"

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