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

Variable inside function? Don't know how to call this

It's hard to explain and I don't know what to call it, but this is what I am trying:

function somethinghere:Fade(speed)
	print(somethinghere)
end

basically being able to change the somethinghere to any instance in the game.

1 comment

0

So... like the thing changes into another thing thats not the original thing???

3 answers

try doing

local somethinghere 
function somethinghere:Fade(speed)
	    somethinghere = game.Workspace.Part.Name
print(somethinghere)
end

if this is what you mean then try it

Well the thing is it's not a specific part, I just want it to find the instance that is getting used for the somethinghere.

I'm not sure what you mean but this might help:

local object

local function afunction ()
	object = Instance.new("Part") --Change the value to anything you want the object to be.
	object.Name = "TheObjectsName"
	--You might wanna change its properties here (size,color,anchored,colidable,etc.)
	object.Parent = workspace
	
	object = Instance.new("Part") --This will make a new instance but the instance made before will not disappear.
end

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