Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make variables carry through functions?

Basically I made two functions the first one uses an instance to make a part. But later in the second function I need to use the part again but it says "Part is an unknown global". Help meh script

function one()
part = Instance.new("Part",game.Workspace)
part.Size = Vector3.new(1,1,1)
end

function two()
part.Size = Vector3.new(4,4,4)                -- Is there a way to fix this?
^(Part is unknown global)
end
connect
connect

1 answer

Store a local variable above the two functions called part, then in one set it (as you are right now) and in two check that part does not equal nil and, if not, proceed to do what you are currently doing.

This discussion is preserved as it was. New answers, comments, and votes are closed.