Beginner OOP stuff

hi developer so i have this code right:

function Teleporter.new(player: Player, signalname: string)
	local self = setmetatable({}, Teleporter)
	self.Player = player
	self.Character = player.Character
	self.SignalName = signalname
	
	return self
end

and i have this remote function thing once it get click it’ll call the function

RemoteEvents.Enter.OnServerEvent:Connect(function(player, signalname)
	local new = Teleporter.new(player, signalname)
end)

so my question is, is it ok calling the function multiple times? or it is a bad practice

Depends, Calling them too fast can lag your game if your code takes a while, However it shouldn’t really be an issue.

1 Like

thank you very much for this <3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.