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

Script isn't getting it's parents childs text button. How do I proceed?

Asked by 3 years ago
script.Parent.SFrame.place.MouseButton1Click:Connect(function()
    place("Thug", true, false)
end)

Image of tree > https://prnt.sc/10fvwrr

Basically, when you click that button, the place function is supposed to go off. It works perfectly fine normally, but when I try to use "Parent.SFrame.place", it doesn't work.

I'm not entirely sure how to get the script.Parent.SFrame(scrolling frame).place(textbutton)

Anyone know how I should proceed?

1 answer

Log in to vote
0
Answered by 3 years ago

Oftentimes, scripts load faster and run before any of their siblings. Referencing these siblings before they have loaded in causes the script to error. This is a super common error and the fix is to simply :WaitForChild().

script.Parent:WaitForChild("SFrame")...
Ad

Answer this question