for example

local player = game.Players.LocalPlayer
local something = player.Name


local DESTROY = game.workspace.something:Destroy()

How do you search for a child's name by using a variable?

2 comments

0

Where it says "something" inside the script it thinks I'm literally searching for a child called something rather then the child, why?

0

So the variable something in this scenario is a string. To search for something in the workspace you can use game.Workspace:FindFirstChild(something) Or WaitForChild(something). Also FindFirstChild or WaitForChild(“namewithoutvariable”). So final product would be Local Destroy = game.Workspace:WaitForChild(something):Destroy()