Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Creating a variable to a part in the player?

Asked by 1 year ago

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

Log in to vote
0
Answered by 1 year ago

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.

Ad

Answer this question