Function Helper
Link:
Function Helper
Description
Function Helper gives useful tools to help so it becomes a bit more easy to code in some aspects of Roblox Studio. Roblox has a variety of syntaxes, which can sometimes be tough to implement. Function Helper plans to make it easy to code in Roblox so that tough things to implement can be made in a matter of seconds.
Why this?
Function Helper gives efficient tools to make some things easier, you can also share, what can be added, and there is a 100% chance I’ll add it.
Commands
Pcalls
FunctionHelper:createSafePcall(functionToExecute, tries <- Optional)
Random
FunctionHelper.getRandomIndexByProbability(probList) --Numbers have to add up to 100
Raycasting
FunctionHelper:Raycast(rayOrigin, rayDirection, filters)
FunctionHelper:shoot(rayOrigin, rayDirection, projectile, deletionTime, filters) -- Better to cast a raycasted line, returns results
FunctionHelper:changeRayDistance(rayDirection, distance) -- Chance distance of ray
Tables
FunctionHelper:sortTable(tableToSort, lowestToHighest <- Boolean) -- Sort a table
Examples
local FunctionHelper = require(game:GetService("ServerScriptService"):WaitForChild("FunctionHelper"))
local distance = 1000 -- Distance for ray to travel
local directionOfRay = Vector3.new(90,0,0) -- Direction for ray to travel
local direction = FunctionHelper:changeRayDistance(directionOfRay, distance)
while true do
local origin = workspace:WaitForChild("Test").Position
FunctionHelper:createSafePcall(function()
local result = FunctionHelper:shoot(origin, direction, game.ServerStorage.Bullet, 0.5, {FilterDescendantsInstances = {workspace.Part}, FilterType = Enum.RaycastFilterType.Blacklist})
if result then
local explosion = Instance.new("Explosion", workspace)
explosion.Position = result.Position
end
end, nil, false)
task.wait(1)
end
local tableToSort = {2,1,5,4}
local sortedTable = FunctionHelper:sortTable(tableToSort, true)
Any suggestions on what I can add or improve on will be appreciated!