Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local usefulModule = {} --[[SCRIPTED BY ZAKRESDEV]]--
- local suffixes = {"", -- These are all of the suffixes for big numbers
- "K",
- "M",
- "B",
- "T",
- "Qd",
- "Qn",
- "Sx",
- "Sp",
- "Oc",
- "No",
- "Dc",
- "Ud",
- "Dd",
- "Td",
- "Qad",
- "Qid",
- "Sxd",
- "Spd",
- "Ocd",
- "Nvd",
- "Vg",
- "Uvg",
- "Dvg",
- "Tvg",
- "Qavg",
- "Qivg",
- "Sxvg",
- "Spvg",
- "Ocvg",
- "Novg"}
- local folder = script:WaitForChild("UsefulModule_Hitboxes"):Clone() -- Clones the folder
- folder.Parent = workspace -- Parents the folder to the Workspace
- usefulModule.PlayAnimation = function(humanoid, animationID, animationSpeed) -- Creates a function called "PlayAnimation"
- local animation = Instance.new("Animation") -- Creating an animation
- animation.AnimationId = "rbxassetid://"..animationID -- Settings the ID of it to the argument sent trough the function
- local track = humanoid:LoadAnimation(animation) -- Loading the animation using the a humanoid
- track:Play() -- Playing the animation
- track:AdjustSpeed(animationSpeed) -- Adjusting its speed with the value sent trough the function
- end
- usefulModule.CreateHitbox = function(duration, anchored, canCollide, cframe) -- Creates a function called "CreateHitbox"
- local hitbox = Instance.new("Part", folder) -- Creates a part
- game:GetService("Debris"):AddItem(hitbox, duration) -- Destroys it after the duration
- hitbox.Anchored = anchored -- Sets the part to unanchored / anchored
- hitbox.CanCollide = canCollide -- Sets the part CanCollide property to false / true
- hitbox.CFrame = cframe -- Sets the position and orientation of the hitbox
- end
- usefulModule.PartRain = function(totalAmount, shape, material, anchored, canCollide, color3fromRGB, height) -- Creates a function called "PartRain"
- local partsFolder = Instance.new("Folder", workspace) -- Creates a folder
- partsFolder.Name = "RainingParts" -- Renames the folder to "RainingParts"
- for count = 1, totalAmount do -- Creates a loop
- local part = Instance.new("Part", partsFolder) -- Creates a part inside the folder
- part.Position = Vector3.new(math.random(-250,250), height, math.random(-250,250)) -- Sets the Part's position to something random
- part.Anchored = anchored -- Sets the part to unanchored / anchored
- part.CanCollide = canCollide -- Sets the part CanCollide property to false / true
- part.Shape = shape -- Sets the part Shape property to Ball / Block / Cylinder
- part.Color = color3fromRGB -- Sets the part Color property to the color sent trough the function
- part.Material = material -- Sets the part Material property to the material sent trough the function
- wait(0.1) -- Creates a cooldown for the loop of 0.1 seconds.
- end
- end
- usefulModule.KillingBoulder = function(damage, cframe, duration, size, material, shape, color3fromRGB) -- Creates a function called "KillingBoulder"
- local hits = {} -- Creates an empty table
- local boulder = Instance.new("Part", workspace) -- Creates a Part
- game:GetService("Debris"):AddItem(boulder, duration) -- Destroys the Part after the duration
- boulder.Name = "UsefulModule_Boulder" -- Renames the part to "UsefulModule_Boulder"
- boulder.Size = size -- Sets the size to the size sent trough the function
- boulder.Material = material -- Sets the part Material property to the material sent trough the function
- boulder.Color = color3fromRGB -- Sets the part Color property to the color sent trough the function
- boulder.CFrame = cframe -- Sets the position and orientation of the hitbox
- boulder.Shape = shape -- Sets the part Shape property to Ball / Block / Cylinder
- boulder.Touched:Connect(function(hit) -- Calls a function when the boulder is touched
- if hit then -- Checks if it did get touched
- if hit.Parent:FindFirstChild("Humanoid") then -- Checks if the hit is a humanoid
- if table.find(hits, hit.Parent) then return -- Checks if the humanoid is already in the table
- else -- If the humanoid isn't in the table yet then...
- hit.Parent:FindFirstChild("Humanoid"):TakeDamage(damage) -- Damages the humanoid
- table.insert(hits, hit.Parent) -- Adds the humanoid inside the table so it doesn't get damaged anymore
- end
- end
- end
- end)
- end
- usefulModule.CreateLeaderstats = function(player) -- Creates a function called "CreateLeaderstats"
- local leaderstats = Instance.new("Folder", player) -- Creates a folder inside the player
- leaderstats.Name = "leaderstats" -- Renames the folder to "leaderstats"
- local coins = Instance.new("NumberValue", leaderstats) -- Creates a NumberValue
- coins.Name = "Coins" -- Renames the NumberValue to "Coins"
- local power = Instance.new("NumberValue", leaderstats) -- Creates a NumberValue
- power.Name = "Power" -- Renames the NumberValue to "Power"
- local rebirths = Instance.new("NumberValue", leaderstats) -- Creates a NumberValue
- rebirths.Name = "Rebirths" -- Renames the NumberValue to "Rebirths"
- end
- usefulModule.AddCurrency = function(currency, increase) -- Creates a function called "AddCurrency"
- currency.Value += increase -- Increases the currency sent trough the function by the number sent trough the function as well
- end
- usefulModule.SubtractCurrency = function(currency, decrease) -- Creates a function called "SubtractCurrency"
- currency.Value -= decrease -- Decreases the currency sent trough the function by the number sent trough the function as well
- end
- usefulModule.DayNightCycle = function(daySpeed) -- Creates a function called "DayNightCycle"
- task.spawn(function() -- Makes it so the function doesn't affect the rest of the code
- while wait(daySpeed) do -- Creates a loop
- game:GetService("Lighting").ClockTime += 0.05 -- Adds 0.05 to the ClockTime
- end
- end)
- end
- usefulModule.Format = function(value) -- Creates a function called "Format"
- for i = 1, #suffixes do -- Loops trough all the suffixes
- if tonumber(value) < 10 ^ (i * 3) then -- checks if the value sent trough the function is smaller than 10 ^ (i * 3)
- return math.floor(value/((10^((i-1)*3))/100))/(100)..suffixes[i] -- Returns the obtained value
- end
- end
- end
- usefulModule.Comma = function(amount) -- Creates a function called "Comma"
- if (math.abs(amount) < 1000) then -- Checks if the amount is smaller than 1000
- return tostring(amount) -- if it is, we will just return the amount
- end
- local str = (amount < 0 and "-" or "") .. tostring(math.abs(math.floor(amount))):reverse():gsub("%d%d%d","%1,"):gsub(",$",""):reverse() -- Adds a "-" or "" between each milestone (K,M,B,T, Qd,etc...)
- if (not (amount == math.floor(amount))) then -- If the amount isn't the amount then
- str = str .. "." .. (tostring(amount):match("%d+.$")) -- Makes the string have a dot
- end
- return str -- Returns the string obtained
- end
- usefulModule.AdvancedDamagingSystem = function(hit, character, emptyTable, damage) -- Creates a function called "AdvancedDamageSystem"
- if hit.Parent.Name == character.Name then return end -- Checks if the hit isn't the player himself
- if hit then -- If there was a hit then...
- if hit.Parent:FindFirstChild("Humanoid") then -- If the hit is a humanoid then...
- if table.find(emptyTable, hit.Parent) then return -- if the humanoid is already in the table then...
- else -- Checks the opposite
- hit.Parent:WaitForChild("Humanoid"):TakeDamage(damage) -- Damages the humanoid
- table.insert(emptyTable, hit.Parent) -- Puts the humanoid inside the table
- end
- end
- end
- end
- usefulModule.TeleportPlayer = function(player, goalCFrame) -- Creates a function called "TeleportPlayer"
- local character = player.Character -- Definds the player's character
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart") -- Definds the player's humanoidRootPart
- humanoidRootPart.CFrame = goalCFrame -- Makes the player's humanoidRootPart CFrame to the CFrame given to the function
- end
- usefulModule.PetFollow = function(player, pet, position) -- Creates a function called "PetFollow"
- if player then -- Checks if the player exists
- local character = player.Character -- Gets the player's character
- if character then -- If the player's character exists (or isn't = nil) then...
- local humanoidRootPart = character.HumanoidRootPart -- Gets the player's humanoidRootPart
- local newPet = pet:Clone() -- Gets the newPet
- newPet.Parent = character -- Parents the newPet to the player's character
- local bodyPos = Instance.new("BodyPosition", newPet) -- Creates a BodyPosition
- bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge) -- Sets the BodyPosition's MaxForce to math.huge (Very big number)
- local bodyGyro = Instance.new("BodyGyro", newPet) -- Creates a BodyGyro
- bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) -- Sets the MaxTorque of the BodyGyro the math.huge
- while wait() do -- Creates a loop
- bodyPos.Position = humanoidRootPart.Position + position -- Constantly sets the pet's position to the player's position with an offset
- bodyGyro.CFrame = humanoidRootPart.CFrame -- Same here
- end
- end
- end
- end
- usefulModule.PrintInstanceCount = function() -- Creates a function called "PrintInstanceCount"
- local instanceCount = #workspace:GetDescendants() -- Gets all the stuff inside the workspace
- print(instanceCount.." Objects") -- Prints the instance name and concatinates " Objects"
- end
- usefulModule.CountTo = function(from, to, increment) -- Creates a function called "CountTo"
- for count = from, to, increment do -- Creates a loop
- if count == to then -- If the count is done counting then...
- print("Done!") -- Prints "Done!" inside the Output Window
- end
- if count ~= to then -- If the count is not done counting then...
- print(count) -- Prints the count
- wait(increment) -- Creates a cooldown
- end
- end
- end
- usefulModule.ClearAllTerrain = function() -- Creates a function called "ClearAllTerrain"
- workspace.Terrain:Clear() -- Clears the terrain entirely
- end
- usefulModule.PrintObjectMass = function(object) -- Creates a function called "PrintObjectMass"
- local objectMass = object:GetMass() -- Gets the mass of the object sent trough the function
- print("The mass of "..object.Name.. " is "..objectMass) -- Prints the mass of the object
- end
- usefulModule.Rebirth = function(rebirths, statsToReset) -- Creates a function called "Rebirth"
- rebirths.Value += 1 -- Increases the Rebirths value by 1
- for index, statToReset in pairs(statsToReset) do -- Gets all the stats to reset inside the statstoreset table
- statToReset.Value = 0 -- Resets the value of the stats to reset
- end
- end
- usefulModule.ConvertCurrencyToSize = function(currency, sizeRate) -- Creates a function called "ConvertCurrencyToSize"
- local player = game.Players:GetChildren() -- Gets all the players
- for i = 1, #player do -- Loops trough all the players
- if player[i].Character ~= nil then -- If the player's character isn't nil then...
- local hum = player[i].Character.Humanoid -- Gets the character's humanoid
- hum.HeadScale.Value = player[i].currency.Value / sizeRate + 1 -- Changes the Head size with the sizeCurrency
- hum.BodyHeightScale.Value = player[i].currency.Value/sizeRate + 1 -- Changes the BodyHeightScale with the sizeCurrency
- hum.BodyWidthScale.Value = player[i].currency.Value / sizeRate + 1 -- Changes the BodyWidthScale with the sizeCurrency
- hum.BodyDepthScale.Value = player[i].currency.Value/sizeRate + 1 -- Changes the BodyDepthScale with the sizeCurrency
- hum.WalkSpeed = player[i].currency.Value / sizeRate -- Changes the WalkSpeed with the sizeCurrency
- hum.JumpPower = player[i].currency.Value / sizeRate -- Changes the JumpPower with the sizeCurrency
- hum.MaxHealth = player[i].currency.Value + sizeRate -- Changes the MaxHealth with the sizeCurrency
- end
- end
- end
- usefulModule.PrintAll = function() -- Creates a function called "PrintAll"
- for index, instance in pairs(workspace:GetDescendants()) do -- Gets all the objects in the Workspace
- print(instance.Name) -- Prints the object name
- end
- end
- return usefulModule -- Makes the module callable from all scripts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement