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

Creating a variable to a part in the player?

I am trying to make a very basic and (tbh a bad way of doing it) magic system. Currently whenever a player joins the game a script creates/clones a part into the player and the part will follow the player around. I'm trying to create a variable to that part whenever a player joins the game in a different script. How can I make that variable? Thank you so much!

1 answer

All you really need is the part's name. Then in another script, you would refer to the part as:

local MagicPart = Character:WaitForChild("PartNameHere")

Since we know that the part will always be added to the player, its safe to use :WaitForChild, which waits for a specified instance to appear.

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