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

How is script.Parent.Parent.Parent.Name Possible?

Asked by 8 years ago
Edited 8 years ago

Hello, I like to learn scripting from looking at other scripts. I see that a line of code says val.Name = script.Parent.Parent.Parent.Name. The script is in one thing under lighting. Like this:

LIGHTING: GUI(Under Lighting) script(Under GUI)

So the script.Parent.Parent.Parent.Name would not be possible because the last Parent would make it the game as the parent. So how is "Name" under the game? It is a Interview GUI in Lighting. But if the script is under an object in Lighting, how is the third parent possible to work and how is Name work if the parent would be game?

script.Parent.Frame:TweenSizeAndPosition(UDim2.new(0, 300, 0, 110), UDim2.new(0.5, -150, 0.5, -55))
function close()
script.Parent.Frame:TweenSizeAndPosition(UDim2.new(0, 0, 0, 0), UDim2.new(0.5, 0, 0.5, 0))
wait(1)
script.Parent:Destroy()
end
function yes()
    if game.ServerStorage.Interviewing.canditates:FindFirstChild(script.Parent.Parent.Parent.Name) == nil then
        local val = Instance.new("StringValue") --Help
        val.Name = script.Parent.Parent.Parent.Name --Help
        val.Parent = game.ServerStorage.Interviewing.canditates --Help
    end
    close()
end
function no()
    close()
end
script.Parent.Frame.y.MouseButton1Click:connect(yes)
script.Parent.Frame.n.MouseButton1Click:connect(no)

This is an interviewing system. So how does the script.Parent.Parent.Parent.Name work? And how does it find "Name"?

Link to Image V

https://postimg.org/image/nk5rk823x/

0
I'm not very sure, as that confuses me too! But I'm thinking it has something todo with script.Parent:Destroy() You still shouldn't trust me with this. FrostTaco 90 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Most likely another script is placing it into a players PlayerGui and or that is already supposed to be in the StarterGui, but either way this script is getting the players name when placed in the PlayerGui.

0
Ok, I wanted to know because I want to make my own Interviewing System. But I couldn't figure out where the .Name came from. vinniehat54 18 — 8y
Ad

Answer this question