Is there a way to delay a require?

basically im trying to slow / not run the require in here

		if game.ReplicatedStorage.Tals:FindFirstChild(tool.T1.Value) then
			local TalFolder = game:GetService("ReplicatedStorage").Tals
			local TalentMod = require(TalFolder:FindFirstChild(tool.T1.Value))
			TalentMod.Yes(hit, tool)
		else
			local BaseGun = require(game:GetService("ReplicatedStorage").Damage:FindFirstChild(gt))
			BaseGun.No(hit, tool)
		end

because im first trying to see if there a module script with a name that matches the value of “T1”, but it just errors before it can do anything because the require runs even if there is nothing of the same name

What you could do is instead of
require(TalFolder:FindFirstChild(tool.T1.Value))
is
require(TalFolder:FindFirstChild(tool:WaitForChild("T1").Value))

1 Like