Can't get instance name

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I would like to be able to get the instance name to search the player with the instance name.

  2. What is the issue? Include screenshots / videos if possible!
    The print gives me “Value”. When in the workspace the instance name is “kArmag0re”.
    Code that searches the name

--This is a server script located in the workspace
local Main = script.Parent.Parent
print(Main.Name) --Gives "Value"

Code that gives the name to the instance

--this is a module scipt, activated by a server script
local Main = Instance.new("StringValue")
Main.Name = Player.Name

Instance in the workspace
Screenshot (1238)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I can’t find a solution

It seems that the server script prints out the name of the instance before it was renamed to the player’s name.

Try adding a wait() on repeat until the name is changed:

--This is a server script located in the workspace
local Main = script.Parent.Parent
repeat wait() until Main.Name ~= "Value"
print(Main.Name)
2 Likes

try using tostring(Main.Name)

(also, i’m not sure if this is a referring issue [where you refer to the incorrect child/parent], or not, but you can try this out first)

1 Like

Oh thank you, it works perfectly now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.