I want to use a function that can acquire the object it is being used on without using any pre-determined local values or using a parameter for the function. I have tried doing so in the following program:

local function SetValue(value)
	self.Value = value
	-- "self" is supposed to be the object the function is used on
end

local int = Instance.new("IntValue")
int.Name = "Integer"



int:SetValue(10)

This does not work. I've been looking for the answer to this for a while. Any help with this?

Thanks for reading, Crazeous

2 comments

1

You can't, and you don't need to. int.Value = 10 is all you need. Maybe if you explained your use case that would help.

0

^ Mhm,