Hello! I am a beginner to Roblox LUA and I was wondering how to use the findchildren and all the other functions.. I do not understand them. If you could pls give me a detailed paragraph. Tyvm!! :)
If you mean functions like FindFirstChild()
and WaitForChild()
then I will explain though I'm not very good with FindFirstChild()
. **FindFirstChild()**
Finds the first child that is in the '()' for example it may be used for a line like script.Parent:FindFirstChild('Humanoid')
. **WaitForChild()**
is kinda the same deal except it is used in the game. For example, in the studio, everything may be working perfectly and yea but when you actually play the game things don't work out. That's because when you just make variables like
local tool = game.ReplicatedStorage.Tool
it's possible 'Tool' hasn't loaded yet, so we would use local tool = game.ReplicatedStorage:WaitForChild('Tool')
this will wait for the child of ReplicatedStorage Tool to load.
If I helped then please accept answer :P
To find the children of something, you want to use the function GetChildren()
that returns a table. For example, the script below gets all the children of the workspace.
wsChildren = workspace:GetChildren()
Each of these children maintain the same properties as they normally would, so to change the children of a certain model to transparent would be like below.
model = game.workspace.Model for i,v in pairs(model:GetChildren()) do if v:IsA('BasePart') then -- checking that the part is actually a part v.Transparency = 1; end end