Hey devs! I want to learn how to use Self. But nobody can anwser this question, so I make my tests.

I want to know if this goodway. ServerScript

local FixStat = 100
GameSetting:ModifCash(function(self) -- I know this can be changed by another variable
	self.TextLabel.Text = '+$'..GameSetting:ConvertShort(FixStat)
end)

ModuleScript

function ModifCash(f)
	local BillboardGui = inst('BillboardGui')
	BillboardGui.ExtentsOffsetWorldSpace = vec3(0, 5, 0)
	BillboardGui.Size = ud2(1, 0, 1, 0)
	local TextLabel = inst('TextLabel')
	TextLabel.TextColor3 = cl3(1, 1, 1)
	TextLabel.Size = ud2(1, 0, 1, 0)
	TextLabel.TextScaled = true
	TextLabel.Transparency = 1
	f(BillboardGui)
end

2 comments

0

This might be of some use to you: https://www.lua.org/pil/16.html

0

Hmmm.. I rwally have difficulty to learn self. I dont understand..