Return variable?

I was working on a script for a commission and I saw the previous scripter wrote what looks like a function but it’s formatted a little different from what I’m used to, an example of what it looked like is:

local variable; do
    -- function stuff
end

Is this like a regular function but sets the return value to a variable or something? I’m not sure if this is even considered a function.

1 Like

It doesn’t do much it’s just a line break creating variable called variable.

Then do end

2 Likes
local Game = game
local RunService = Game:GetService("RunService")

local function OnStep(Connection)
	Connection:Disconnect()
end

local Connection do
	Connection = RunService.Stepped:Connect(function() OnStep(Connection) end)
end

That idiom is typically employed in order for a variable to be included in a chunk’s scope.

3 Likes