Hi I am here to show you guys my Custom Function Module and I was wondering if you liked it or any ideas for functions that do not exist in ROBLOX!
code:
local functionMod = {}
function functionMod:FindFirstDescendantOfClass(instancePart,class)
for _, part in pairs(instancePart:GetDescendants()) do
if part:IsA(class) then
print("Found " .. class .. " with the name of " .. part.Name)
break
elseif not part:IsA(class) then
warn(part.Name .. ":" .. " is not a " .. class)
end
end
end
function functionMod:BreakAttachments(instancePart)
for _, attach in pairs(instancePart:GetDescendants()) do
if attach:IsA("Attachment") then
print(attach.Name .. ":" .. " Destroyed")
attach:Destroy()
elseif not attach:IsA("Attachment") then
warn(attach.Name .. ":" .. " is not a Attachment")
end
end
end
function functionMod:PrintTable(tableName)
for tableKey, tableVal in pairs(tableName) do
print(tableKey .. ":", tableVal)
end
end
function functionMod:Visibility(instancePart,amount)
instancePart.Transparency = tonumber(amount)
end
function functionMod:MultiClone(instancePart,waitTime,cloneAmount,parent)
local cloned = 0
while wait(waitTime) do
if cloned >= tonumber(cloneAmount) then
break
end
cloned += 1
instancePart:Clone().Parent = game:FindFirstChildOfClass(parent)
end
end
function functionMod:ChangeColor(instancePart,color)
instancePart.BrickColor = color
end
function functionMod:WaitForChildOfClass(instancePart,class)
for _, value in pairs(instancePart:GetDescendants()) do
repeat wait() until value:IsA(class)
print(value.Name)
end
end
function functionMod:PartPosition(instancePart,part)
if instancePart and part then
instancePart.Position = part.Position
end
end
function functionMod:TeleportTo(instancePart,part)
if instancePart and part then
if instancePart:IsA("Model") then
if instancePart.PrimaryPart then
instancePart:SetPrimaryPartCFrame(part.CFrame)
else
warn("Model needs PrimaryPart to call this function!")
end
end
end
end
function functionMod:SetGravity(gravity)
if gravity then
game.Workspace.Gravity = tonumber(gravity)
end
end
function functionMod:FindPlayer()
for _, player in pairs(game.Players:GetPlayers()) do
if player then
return player
end
end
end
function functionMod:SetVelocity(instancePart,velocity)
if instancePart and velocity then
instancePart.Velocity = tonumber(velocity)
end
end
function functionMod:tobool(instanceVal)
if type(instanceVal) ~= "string" then
return nil
end
if instanceVal:lower() == "true" then
return true
elseif instanceVal:lower() == "false" then
return false
end
end
return functionMod
Criticism appreciated! ![]()