Better way to write a basic statement

Very simple question, but I was wondering if there was a better way to wrtie this rather than repeating the same thing directly after eachother (other than just making a variable with it a line directly above).

if workspace:FindFirstChild("Beam "..lp.Name) then
	workspace:FindFirstChild("Beam "..lp.Name):Destroy()
end

The only thing you can really do is just put the result in a variable, there’s no real way to shorten that to be smaller, the only way you could is if you know that there’s always going to be a beam with that type of name, but that would defeat the purpose of FindFirstChild

local beam = workspace:FindFirstChild("Beam " .. lp.Name)
if beam then
    beam:Destroy()
end
1 Like

Shorten: ```
local thing = workspace.FindFirstChild

if thing() == true then thing():Destroy() end