· 7 years ago · Jan 20, 2019, 06:34 AM
1-- Created and produced by Cvieyra2test
2
3-- CVExtra (2) -- Super Module Script
4
5-- Contributors, Code, Tips & Functions are pass the "License"
6
7
8--[[
9 L I C E N S E
10https://choosealicense.com/licenses/mit/
11
12 Copyright (c) 2018-2019 Christian V/Cvieyra2test/cvieyra
13
14 Permission is hereby granted, free of charge, to any person obtaining a copy
15 of this software and associated documentation files (the "Software"), to deal
16 in the Software without restriction, including without limitation the rights
17 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 copies of the Software, and to permit persons to whom the Software is
19 furnished to do so, subject to the following conditions:
20
21 The above copyright notice and this permission notice shall be included in all
22 copies or substantial portions of the Software.
23
24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 SOFTWARE.
31
32 -->> Additional <<--
33 It is recommended, but not forced, to have altered code open-source. As to help others educate and familiarize
34 themselves in a coding environment. Holders of code may keep their altered code closed or may sell it, but
35 may not lay claim to the original document by Cvieyra2test/cvieyra/Christian V and cannot authorize a copyright
36 strike against them if similar code is found in updated documents as well as can't lay copyright strikes against
37 the Roblox Corporation. Check 6B, part 3 of document: https://en.help.roblox.com/hc/en-us/articles/115004647846-Roblox-Terms-of-Use
38 for further information on Roblox's rights to the property.
39
40 This module script is intended to help others in coding and developing their games.
41
42--]]
43--[[
44 C O N T R I B U T O R S
45
46 CloneTrooper1019 (https://www.roblox.com/users/2032622/profile) -- Created the colorFromHex
47 TheeDeathCaster (https://www.roblox.com/users/17514438/profile) -- Provided help with limitedTable, criticism
48 SinisterMemories (https://www.roblox.com/users/39939779/profile) -- Provided colourMix
49 Phlegethon5778 (https://www.roblox.com/users/220051208/profile) -- Mild Criticism
50 buildthomas (https://www.roblox.com/users/1659965/profile) -- Provided the "for loop" for tablereverse (https://devforum.roblox.com/t/how-would-i-reverse-a-table/152785)
51
52--]]
53
54---------------------------- USAGE: ----------------------------
55
56-- This following tutorial assumes you put CVExtra in workspace, if you put it in any other game-based container,
57-- simply change "workspace" to game.nameOfTheContainer.CVExtra or game:GetService("nameOfTheContainer").CVExtra
58
59--[[
60 I M P O R T A N T
61
62--> There also appears to be an issue with localscripts requiring the module script.
63--> Simply find the function you want from the module script, select & copy it, then paste it into your
64 local script in the beginning of your local script.
65--> Make sure to check any functions in the script under anything called "--REQUIRED FUNCTIONS" to check what
66 what other functions the function uses.
67--> Or just simply, copy the entire code from start to bottom so you can just run it like you would in a server script
68
69
70--]]
71--[[
72 T U T O R I A L
73
74 HOW TO GET A SCRIPT TO USE IT:
75 Do this on the global scope of a script (not inside a function or "if" or loop statement):
76 CVExtra = require(workspace.CVExtra)
77 To do a function inside CV Extra, you'd do:
78 CVExtra.capitalize("louis") to get "Louis"
79 You can locally define CVExtra functions like this:
80 numbify = CVExtra.numbify (for a global scale) OR local numbify = CVExtra.numbify (for inside a function or etc)
81 Although there is functions that are stored in a table within CVEXtra, in this case we'd do:
82 CVExtra.Math -- to get it, and to get functions in it, we'd do: CVExtra.Math.square
83
84--]]
85----------------------------------------------------------------------------------------------------------
86--[[
87 T I P S
88
89 Deletion: instance.Parent = nil (or) instance:Destroy()
90
91 Infinity: math.huge()
92
93 Getting A List of Players: game.Players:GetPlayers() (or) game:GetService("Players"):GetPlayers()
94
95 Getting the model of a player: game.Players.(Player).Character
96
97 Getting power of number: num^num (Instead of using "math.square" or "math.cube")
98
99 Part:FindFirstChild("instance",true) will attempt to find a part named "instance" within all children of "Part" (Entirety of descendants)
100
101 Unions have a "UsePartColor" property that sets unions to their colour. It is a bool value that is sometimes enabled upon the creation of a union, usually disabled.
102
103 You can set colours for parts via BrickColor.new() (Check http://wiki.roblox.com/index.php?title=BrickColor) or using Color3 functions like Color3.fromRGB(200,20,60) or Color3.new(0.75,0.43,0.89)
104
105 CTRL+SHIFT+F (Windows) will bring up a window called "Find in All Scripts" that will find the specified key word within ALL scripts (maybe good for finding viruses)
106
107 math.min() will get the lowest number of a provided list (tuple)
108
109 math.max() will get the highest number of a provided list (tuple)
110
111 string.reverse() will reverse the provided string, e.g. "Alvin" to "nivlA"
112
113 typeof() will return the type of object (including userdata derivatives like "instance" and "color3") specified in its parameters
114
115 math.sign() can be used to determine if a number is a negative(returns -1), zero(returns 0) or positive(returns 1). math.sign(-93) will return -1. math.sign(3) will return 1.
116
117 Pressing TAB while selecting code will indent it. Contrary to TAB, SHIFT+TAB will unindent it.
118
119
120 F U N C T I O N S
121
122 numbify(string) -- Gets numbers & decimal point from a provided string
123 EXAMPLE USAGE: numbify("It is 30.5 degrees celsius outside!!!")
124 RETURNS: 30.5
125
126Math -- CVExtra.Math (PREFIX functions with Math.)
127
128 >>round(number) -- Rounds a number depending on its tenth digit (0.1)
129 EXAMPLE USAGE: round(3.5)
130 RETURNS: 4
131
132 >>square(number) -- Squares a number -- a number to the power of 2 (num^2)
133 -- This function exists due to aesthetics, as (num^2) is much quicker & efficient
134 EXAMPLE USAGE: square(5)
135 RETURNS: 25
136
137 >>cube(number) -- Cubes a number -- a number to the power of 3 (num^3)
138 -- This function exists due to aesthetics, as (num^3) is much quicker & efficient
139 EXAMPLE USAGE: cube(3)
140 RETURNS: 9
141
142 >>area(number,number) -- Creates an area (squared space) from two numbers
143 EXAMPLE USAGE: area(3,7)
144 RETURNS: 21
145
146 >>volume(number,number,number) -- Creates a volume (cubed space) from three numbers
147 EXAMPLE USAGE: volume(3,8,2)
148 RETURNS: 48
149
150 >>inverse(number) -- Creates the opposite of a number -- inverse
151 EXAMPLE USAGE: inverse(3)
152 RETURNS: -3
153
154<<-- Math ------------------
155
156 randomPercentage(number percent) -- Percent must be a number -- Checks if provided percent is lower than or equal to a randomized number that ranges from 1-100, provides true or false
157 EXAMPLE USAGE: randomPercentage(25)
158 RETURNS: true (or) false (depending if it equals to or is lower than randomized number)
159
160 percent(number,number,bool round) -- Gets percentage from two numbers, the bool determines whether or not it rounds the percentage
161 EXAMPLE USAGE: percent(8,10)
162 RETURNS: 80
163 IF BOOL
164 EXAMPLE USAGE: percent(7,11,true)
165 RETURNS: 0.6
166
167 capitalize(string) -- Capitalizes the first letter of any string
168 EXAMPLE USAGE: "louis is a goodman"
169 RETURNS: "Louis is a goodman"
170
171 printIndent(number indents) -- Intended to be used in the script output, otherwise pointless to use
172 EXAMPLE USAGE: printIndent(3)
173 RETURNS: (3 indents in the output)
174
175 playAudio(instance sound,number playbackSpeed,number starTime,number endTime) -- Plays audio in an advanced way -- Sound = An Instance of Sound, 1st Number = PlaybackSpeed, 2nd Number = startTime, 3rd Number = endTime -- Can play audio at a specified startTime and end at a certain endTime in correlation with the playbackSpeed -- playAudio also updates startTime & endTime according to updates in playbackSpeed
176 EXAMPLE USAGE: playAudio(sound)
177 Plays audio, updates startTime & endTime in conjunction with updates in playbackSpeed of Audio
178 (or)
179 EXAMPLE USAGE: playAudio(sound,1.2)
180 Plays audio, setting its playbackSpeed to "1.2"
181 (or)
182 EXAMPLE USAGE: playAudio(sound,1,5)
183 Plays audio at startTime "5" (5 seconds into audio) -- With the sound's playbackSpeed set to "1"
184 (or)
185 EXAMPLE USAGE: playAudio(sound,1,0,3)
186 Plays audio at StartTime "0" -- With playbackSpeed set to "1" -- Ending at "3" (3 seconds into Audio)
187
188 getPlayer(string name) -- Returns the player object based on the string provided (must be exact, it is caps sensitive), intended for functions in the module script
189 EXAMPLE USAGE: getPlayer("Cvieyra2test")
190 RETURNS: (If it finds it) game.Players.Cvieyra2test
191
192 createleaderStats(instance player/string name) -- Adds a "leaderstats" to the select player -- Can use a string to find the player -- Returns the leaderstats
193 EXAMPLE USAGE: createleaderStats(player) -- Assuming "player" is defined as a player
194 RETURNS: leaderstats
195
196 clean(instance container,string specification,bool turbo) -- Checks for empty (no children) instances (that match the given string) within the specified instance -- the "Bool" is "Turbo" which determines whether or not it'll do it slowly but lag-free or quickly, but potentially laggy
197 EXAMPLE USAGE: clean(workspace,"model",true)
198 Checks through workspace for "model" 's that have no children, then deletes them, at a quick, mere instantaniously pace
199
200 cleanHats(bool turbo) -- Cleans up hats left in the workspace -- Bool = Turbo, if turbo then does it quick, but potentially laggy, otherwise slowly, but lag-free
201 EXAMPLE USAGE: cleanHats(true)
202 Quickly deletes all hats in the workspace
203
204 areaOf(instance BasePart/instance GUIObject) -- Gets an "area" of a part or GUIObject from its X & Z or X & Y (if GUI) -- Does not accurately calculate by shape
205 EXAMPLE USAGE: areaOf(workspace.Part) -- With measurements: 2,3,2
206 RETURNS: 4
207
208 volumeOf(instance BasePart) -- Gets a "volume" of a part from tis X, Y & Z -- Does not accurately calculate by shape
209 EXAMPLE USAGE: volumeOf(workspace.Part) -- With measurements 2,3,2
210 RETURNS: 12
211
212colours -- CVExtra.colours (PREFIX functions with colours.)
213
214 >>list.(somecolour) -- A list of prepicked colours -- How to get "highlighter" from list: colours.highlighter (or) colours.getColour("highlighter")
215
216 >>addColour(string name,color3 rgb) -- Adds a custom colour with the specified RGB code, named the provided string to colours.list
217 EXAMPLE USAGE: addColour("pyrite2",Color3.fromRGB(138,125,94)) -- "Color.fromRGB(138,125,94)" can be replaced with a RGB variable
218 RETURNS: list["pyrite2"]
219
220 >>getColour(string name) -- Gets a colour from list
221 EXAMPLE USAGE: getColour("caramel")
222 RETURNS: list["caramel"] -- RGB: 185,93,1
223
224 >>darken(color3 rgb,number amount) -- Darkens a color3 by a percentage amount (number from 1-100)
225 EXAMPLE USAGE: darken(Color3.fromRGB(240,210,100),10)
226 RETURNS: 0.841177, 0.736029, 0.35049 (Color3)
227
228 >>lighten(color3 rgb,number amount) -- Brightens a color3 by a percentage amount (number from 1-100)
229 EXAMPLE USAGE: lighten(Color3.fromRGB(120,40,60),10)
230 RETURNS: 0.570588, 0.190196, 0.285294 (Color3)
231
232 >>desaturate(color3 rgb,number amount) -- Desaturates a color3 by a percentage amount (number from 1-100)
233 EXAMPLE USAGE: desaturate: desaturate(Color3.fromRGB(200,100,20),10)
234 RETURNS: 0.884314, 0.442157, 0.0884314 (Color3)
235
236 >>saturate(color3 rgb,number amount) -- Saturates a color3 by a percentage amount (number from 1-100)
237 EXAMPLE USAGE: saturate(Color3.fromRGB(120,102,130),10)
238 RETURNS: 0.562896, 0.478462, 0.609804 (Color3)
239
240 >>Color3fromHex(color3 hex) -- Gets a Color3 from a Hex Colour
241 EXAMPLE USAGE: Color3fromHex(0x42d1f4)
242 RETURNS: 0.258824, 0.819608, 0.956863 (Color3)
243
244 >>Color3fromVector3(vector3 v3) -- Gets a Color3 from a Vector3, meant for Mesh.VertexColor
245 EXAMPLE USAGE: Color3fromVector3(Vector3.new(0.83,0.2,0.5))
246 RETURNS: 0.83,0.2,0.5
247
248 >>getList() -- Gets entire list of names of provided colours in list
249 EXAMPLE USAGE: getList()
250 RETURNS: (all colours in colours.list, their names)
251
252 >>random() -- Gets a random colour from colours.list
253 EXAMPLE USAGE: random()
254 RETURNS: (random colour RGB) (and) (random colour name)
255
256 >>absoluterandom() -- Creates a completely random colour
257 EXAMPLE USAGE: absoluterandom()
258 RETURNS: (a random colour from randomized R,G,B)
259
260 >>colourMix(Color3 color1, Color3 color2) -- Mixes two colour values
261 EXAMPLE USAGE: colourMix(Color3.fromRGB(255,100,0),Color3.fromRGB(0,5,230))
262 RETURNS: (Color3) 0.5,0.205882,0.45098 (A purple-ish colour)
263
264<<-- colours ------------------
265
266 getChar(string s,number iterator) -- Gets a character from specified iteration of string
267 EXAMPLE USAGE: getChar("Bosho",3)
268 RETURNS: "s"
269
270 decimalPointLength(number) -- Gets the decimal length of a number
271 EXAMPLE USAGE: decimalPointLength(4.59)
272 RETURNS: 2
273
274 power10(number) -- Function intended for internal module functions, not intended for actual use
275 EXAMPLE USAGE: power10(5)
276 RETURNS: 100000
277
278 mathrandom(number num1,number num2,bool round)
279 EXAMPLE USAGE: mathrandom(2.4,8)
280 RETURNS: (any number between 2.4 & 8, with specified decimal length of the number with longest decimal length)
281
282 GetAllChildren(instance,bool turbo) -- Gets children of specified instance, does it quick but potentially laggy with turbo, likewise, slow & no-lag without
283 EXAMPLE USAGE: GetAllChildren(workspace,true)
284 RETURNS: (All children within workspace at "turbo" speed (no-wait()) )
285
286 antivirus() -- Checks through certain places for "viruses"
287 EXAMPLE USAGE: antivirus()
288 RETURNS: virusf (A file containing suspected viruses)
289
290 isodd(number) / iseven(number) -- Determines if a number is odd or even
291 EXAMPLE USAGE: isodd(3)
292 RETURNS: "odd"
293
294 toCharList(string) -- Converts a string to a table containing individual characters
295 EXAMPLE USAGE: "Honduras"
296 RETURNS: {"H","o","d","u","r","a","s"}
297
298 charlistToString(table) -- Intended as the reverse to "toCharList" -- not meant for any other purpose
299 EXAMPLE USAGE: charlistToString({"L","u","k","e"})
300 RETURNS: "Luke"
301
302conversion -- CVExtra.conversion (PREFIX functions/tables with conversion.)
303
304 >>addTo() -- Appends alternative forms of measurements to "conversions" list
305 EXAMPLE USAGE: addTo()
306 (Not intended for user/script use)
307
308 >>length -- CVExtra.conversion.length (PREFIX functions with length.)
309
310 >>>>conversions -- A list of preset measurements and their numbers
311
312 >>>>toMillimetres(string toConvertFrom,number)
313 EXAMPLE USAGE: toMillimetres/toMillimeters("metre",1)
314 RETURNS: 1000
315
316 >>>>toCentimetres/toCentimeters(string toConvertFrom,number)
317 EXAMPLE USAGE: toCentimetres("metre",2)
318 RETURNS: 200
319
320 >>>>toDecimetres/toDecimeters(string toConvertFrom,number)
321 EXAMPLE USAGE: toDecimetres("centimetre",10)
322 RETURNS: 1
323
324 >>>>toStuds(string toConvertFrom,number)
325 EXAMPLE USAGE: toStuds("centimetre",80)
326 RETURNS: 4
327
328 >>>>toMetres/toMeters(string toConvertFrom,number)
329 EXAMPLE USAGE: toMetres("centimetre",200)
330 RETURNS: 2
331
332 >>>>toKilometres/toKilometers(string toConvertFrom,number)
333 EXAMPLE USAGE: toKilometres("metres",1000)
334 RETURNS: 1
335
336 >>>>toInches(string toConvertFrom,number)
337 EXAMPLE USAGE: toInches("feet",2)
338 RETURNS: 24
339
340 >>>>toFeet(string toConvertFrom,number)
341 EXAMPLE USAGE: toFeet("inch",18)
342 RETURNS: 1.5
343
344 >>>>toYards(string toConvertFrom,number)
345 EXAMPLE USAGE: toYards("feet",6)
346 RETURNS: 2
347
348 >>>>toMiles(string toConvertFrom,number)
349 EXAMPLE USAGE: toMiles("feet",5280)
350 RETURNS: 1.0002137973897 (Supposed to be 1)
351
352 >>>>toNauticalMiles(string toConvertFrom,number)
353 EXAMPLE USAGE: toNauticalMiles("miles",1.16)
354 RETURNS: 1.0077969762419
355
356 >>>>Convert(string toConvertTo,string toConvertFrom,number FromUnits)
357 EXAMPLE USAGE: Convert("Stud","CM",40)
358 RETURNS: 2 (Studs)
359 <<-- length ------------------
360
361 >>liquid -- CVExtra.conversion.liquid (PREFIX functions with liquid.)
362
363 >>>>conversions -- A list of preset measurements and their numbers
364
365 >>>>toMillilitres/toMilliliters(string toConvertFrom,number)
366 EXAMPLE USAGE: toMillilitres("litre",1)
367 RETURNS: 1000
368
369 >>>>toCentilitres/toCentiliters(string toConvertFrom,number)
370 EXAMPLE USAGE: toCentilitres("millilitre",10)
371 RETURNS: 1
372
373 >>>>toDecilitres/toDeciliters(string toConvertFrom,number)
374 EXAMPLE USAGE: toDecilitres("litre",5)
375 RETURNS: 50
376
377 >>>>toLitres/toLiters(string toConvertFrom,number)
378 EXAMPLE USAGE: toLitres("centilitre",300)
379 RETURNS: 3
380
381 >>>>toKilolitres/toKiloliters(string toConvertFrom,number)
382 EXAMPLE USAGE: toKilolitres("litre",6000)
383 RETURNS: 6
384
385 >>>>Convert(string toConvertTo,string toConvertFrom,number FromUnits)
386 EXAMPLE USAGE: Convert("decilitre","litre",10)
387 RETURNS: 100
388
389 <<-- liquid ------------------
390
391 >>time -- CVExtra.conversion.time (PREFIX functions with time.)
392
393 >>>>conversions -- A list of preset measurements and their numbers
394
395 >>>>toSeconds(string toConvertFrom,number)
396 EXAMPLE USAGE: toSeconds("minute",4)
397 RETURNS: 240
398
399 >>>>toMinutes(string toConvertFrom,number)
400 EXAMPLE USAGE: toMinutes("second",120)
401 RETURNS: 2
402
403 >>>>toHours(string toConvertFrom,number)
404 EXAMPLE USAGE: toHours("minute",300)
405 RETURNS: 5
406
407 >>>>toDays(string toConvertFrom,number)
408 EXAMPLE USAGE: toDays("hour",24)
409 RETURNS: 1
410
411 >>>>toWeeks(string toConvertFrom,number)
412 EXAMPLE USAGE: toWeeks("day",14)
413 RETURNS: 2
414
415 >>>>Convert(string toConvertTo,string toConvertFrom,number FromUnits)
416 EXAMPLE USAGE: Convert("week","hour",252)
417 RETURNS: 1.5
418
419 <<-- time ------------------
420
421 >>temp -- CVExtra.conversion.temp (PREFIX functions with temp.)
422
423 >>>>conversions -- A list of preset measurements and their numbers
424
425 >>>>toFahrenheit(string toConvertFrom,number)
426 EXAMPLE USAGE: toFahrenheit("celsius",3)
427 RETURNS: 37.4
428
429 >>>>toCelsius(string toConvertFrom,number)
430 EXAMPLE USAGE: toCelsius("fahrenheit",210.5)
431 RETURNS: 192.72222222222
432
433 >>>>toKelvin(string toConvertFrom,number)
434 EXAMPLE USAGE: toKelvin("celsius",14)
435 RETURNS: 287.15
436
437 >>>>Convert(string toConvertTo,string toConvertFrom,number FromUnits)
438 EXAMPLE USAGE:
439 RETURNS:
440
441 <<-- temp ------------------
442
443<<-- conversion ------------------
444
445 checkLegitimateMatch(string s,string match,bool caseinsensitive) -- String, to find in beginning of String, caseinsensitive? -- Checks if the specified string matches the match (from beginning of match & string to end of match)
446 -- Can utilize tables/arrays, using their strings and matching them, returns a table
447 EXAMPLE USAGE: checkLegitimateMatch("Hunter","Hun") -- caseinsensitive will be "false" default if not specified
448 RETURNS: "Hunter"
449 (or)
450 EXAMPLE USAGE: checkLegitimateMatch({"Jallo","Dallas","Jade","Jollon","janne"},"Ja")
451 RETURNS: {"Jallo","Jade"}
452 (or)
453 EXAMPLE USAGE: checkLegitimateMatch({"Jynom","jynhorb","Jyroem"},"jyn",true) -- However, if you want to accept any case as well
454 RETURNS: {"Jynom","jynhorb"}
455
456 GetPlayersFromString(string s,bool caseinsensitive) -- Creates an array, finding players that start with the specified string
457 EXAMPLE USAGE: GetPlayersFromString("cvieyra",true) -- Assuming there's players that begin with "cvieyra"
458 RETURNS: {game.Players.Cvieyra2test} -- Assuming there is "Cvieyra2test" in the server
459
460 removeLetter(string s,integer iteration)
461 EXAMPLE USAGE: removeLetter("Coorsicus",2)
462 RETURNS: "Corsicus" -- Removing the second letter from "Coorsicus"
463
464 addLetter(string s,string addletter,integer iteration)
465 EXAMPLE USAGE: addLetter("Marcs","u",5)
466 RETURNS: "Marcus" -- Always adds a letter behind the iterated letter
467
468 replaceLetter(string s,string replaceletter,integer iteration)
469 EXAMPLE USAGE: replaceLetter("Herkules","c",4)
470 RETURNS: (issue)
471
472photomanipulation-- CVExtra.photomanipulation (PREFIX functions with photomanipulation.)
473
474 >>blacknwhite(color3 rgb) -- Turns colours into a black&white setting
475 EXAMPLE USAGE: blacknwhite(Color3.new(0.2,0.63,0.34)) -- A green
476 RETURNS: (Color3) 0.627451,0.627451,0.627451 (A grey)
477
478 >>sepia(color3 rgb) -- Turns colours into a sepia setting
479 EXAMPLE USAGE: sepia(Color3.new(0.6,0,0.7)) -- A purple-magenta
480 RETURNS: (Color3) 0.698039,0.384114,0.0684352 (A brown)
481
482 >>cyanotype(color3 rgb) -- Turns colours into a cyanotype setting
483 EXAMPLE USAGE: cyanotype(Color3.new(0.7,0.4,0.3)) -- A reddish-brown, rustic
484 RETURNS: (Color3) 0.298039,0.594418,0.698039 (A moderate blue)
485
486 >>customtonetowhite(color3 rgb,color3 rgbp)
487 EXAMPLE USAGE: customtonetowhite(Color3.fromRGB(202, 144, 89),Color3.fromRGB(104, 179, 24))
488 RETURNS: (color3) 0.57773566246033,0.79215693473816,0.34901961684227 (ELSE) (rgb) 147,202,89
489
490 >>photomlist -- A list of different definitions for photomanipulation variables (blacknwhite, sepia, etc)
491
492 >>world(string modename,variant customarg1)
493 EXAMPLE USAGE: world("sepia")
494 Sets most instances' (that have a color3) color3 to the sepia photomanipulation mode
495 (or)
496 EXAMPLE USAGE: world("customtonetowhite",Color3.fromRGB(255,64,0))
497
498 >>vision(string modename,variant customarg1)
499 EXAMPLE USAGE: vision("blacknwhite")
500 Adds a "ColorCorrectionEffect" to game.Lighting, sets saturation to 0 and sets colour to the specified mode, "blacknwhite"
501 (or)
502 EXAMPLE USAGE: vision("customtonetowhite",Color3.fromRGB(35,71,139))
503
504<-- photomanipulation ------------------
505
506 dropHats(player plr) -- Drops the hats of a specified player
507 EXAMPLE USAGE: dropHats(game.Players.Cvieyra2test) -- Will drop hats of player "Cvieyra2test"
508 RETURNS: (an array of the hats the player had)
509 (or)
510 EXAMPLE USAGE: dropHats("Cvieyra2test") -- Will attempt to find "Cvieyra2test" inside players, then drops their hats
511 RETURNS: (an array of the hats the player had)
512
513 getAncestry(instance) -- Gets the ancestry of a specified instance (all its parents)
514 EXAMPLE USAGE: getAncestry(workspace.Part.Mesh) -- If there's a thing named "Mesh" inside of a thing named "Part" inside of workspace
515 RETURNS: {workspace,Part} -- A list of the parents of "Mesh" from last (biggest) parent to first parent
516
517 getCommands() -- Gets all functions in CVExtra
518 EXAMPLE USAGE: getCommands()
519 RETURNS: (an array of all functions in CVExtra)
520
521 limitedTable(number length,string name) -- A "limitedTable" is a table that can only have so many variables in it
522 EXAMPLE USAGE: limitedTable(3,"y") -- Table cannot have more than 3 items, will throw a "warn" if it exceeds and deletes the appended value
523 RETURNS: (An empty array with the supposed name, "y")
524
525 WaitForChildOfClass(instance parent,string classname,number timeout)
526 EXAMPLE USAGE: WaitForChildOfClass(game.Players.Player1.PlayerGui,"ScreenGui") -- Will attempt to find a "ScreenGui" class for about 5 seconds inside of Player1's PlayerGui
527 RETURNS: (If it exists) [The ScreenGui found] (If it doesn't appear in the first (timeout(5)) seconds) [nil]
528 (or)
529 EXAMPLE USAGE: WaitForChildOfClass(game.Players.Player1.PlayerGui,"ScreenGui",10) -- Will attempt to find a "ScreenGui" class for about 10 seconds inside of Player1's PlayerGui
530 RETURNS: (If it exists) [The ScreenGui found] (If it doesn't appear in the first (timeout(10)) seconds) [nil]
531
532 tablereverse(table t) -- Reverses a table
533 EXAMPLE USAGE: tablereverse({"T","a","c","o"})
534 RETURNS: {"o","c","a","T"}
535
536--]]
537
538-- Module Scripts & Contents Below \/ \/ \/ \/
539
540-- IF COPYING TO LOCAL SCRIPT, YOU SHOULD JUST COPY FROM HERE, ALL THE WAY DOWN TO THE LAST LINE (2000+ lines)
541
542wait(1)
543local CVExtra = {}
544CVExtra = {
545 numbify = function(s) -- Converts a string (with letters) to a number
546 -- EXAMPLE USAGE: numbify("Hello, it is 20.4 degrees celsius outside!") -- Returns only the numbers & the only decimal point in a string, in this case, the string --> 20.4
547 local result = nil
548 if type(s)=="string" then
549 local i = 1
550 local num = ""
551 local match = "[%d%.]+"
552 local negativecheck = true
553 while (i<=string.len(s)) do
554 if negativecheck == true and string.match(s.sub(s,i,i),"-") then
555 num = s.sub(s,i,i)
556 negativecheck = false
557 end
558 if string.match(s.sub(s,i,i),match) then
559 negativecheck = false
560 num = num..s.sub(s,i,i)
561 if (s.sub(s,i,i) == ".") then
562 match = "%d+"
563 end
564 end
565 i = i+1
566 end
567 result = tonumber(num)
568 elseif type(s)=="number" then
569 result = s
570 end
571 return result
572 end,
573 Math = {
574 round = function(num)
575 -- EXAMPLE USAGE: round(1.86) -- rounds specified number to a non-decimal number by rounding it to a lower or higher integer, in this case, 1.86 --> 2
576 local result = nil
577 if type(num) == "number" then
578 result = math.floor(num+0.5)
579 end
580 return result
581 end,
582 square = function(num) -- The mathematical operation "^" could be used alternatively: 4^2
583 -- EXAMPLE USAGE: square(4) -- squares (*2) the specified number, in this case, 4*4 = 16
584 local result = nil
585 if type(num)=="number" then
586 result = num*num
587 end
588 return result
589 end,
590 cube = function(num) -- The mathematical operation "^" could be used alternatively: 7^3
591 -- EXAMPLE USAGE: cube(7) -- cubes (*3) the specified number, in this case, 7*7*7 = 343
592 local result = nil
593 if type(num)=="number" then
594 result = num*num*num
595 end
596 return result
597 end,
598 area = function(num1,num2)
599 -- EXAMPLE USAGE: area(2,9) -- Gets the 2D area of the specified parameters, in this case, 2*9 is 18
600 local result = nil
601 if type(num1)=="number" and type(num2)=="number" then
602 result = num1*num2
603 end
604 return result
605 end,
606 volume = function(num1,num2,num3)
607 -- EXAMPLE USAGE: volume(1,5,3) -- Gets the 3D volume of the specified parameters, in this case, 1*5*3 (the volume of specified object) is 15
608 local result = nil
609 if type(num1)=="number" and type(num2)=="number" and type(num3)=="number" then
610 result = (num1*num2)*num3
611 end
612 return result
613 end,
614 inverse = function(num) -- Returns the inverted form of a number
615 -- EXAMPLE USAGE: inverse(2) -- Will return -2
616 local result = nil
617 if type(num)=="number" then
618 result = num-(num*2)
619 end
620 return result
621 end,
622 },
623 randomPercentage = function(percent) -- makes a math random determining if the percent provided is higher than the random, returns true if so
624 -- EXAMPLE USAGE: randomPercentage(20)
625 if type(percent) == "number" then
626 local randomResult = math.random(1,100)
627 if randomResult <= percent then
628 return true
629 else
630 return false
631 end
632 else
633 return nil
634 end
635 end,
636 percent = function(num1,num2,round)
637 -- EXAMPLE USAGE: percent(3,6) -- Returns the percentage of num1 of num2, in this case, 3 out of 6 is 50% -- "round" must be true or false, it indicates whether or not it rounds the perecentage
638 local rawPercentage = (num1/num2)*100
639 local Percentage
640
641 -- REQUIRED FUNCTIONS:
642 local mround = CVExtra.Math.round
643 --
644
645 if round == true then
646 Percentage = mround(rawPercentage)
647 else
648 Percentage = rawPercentage
649 end
650 return Percentage
651 end,
652 capitalize = function(s) -- Capitalizes a string
653 -- EXAMPLE USAGE: capitalize("louis") -- Will capitalize specified string, in this case, "louis" to "Louis"
654 local newS = nil
655 if type(s) == "string" then
656 local newC = string.upper(string.sub(s,1,1))
657 local tempS = CVExtra.removeFirstLetter(s)
658 newS = newC..tempS
659 end
660 return newS
661 end,
662 printIndent = function(num) -- quite a useless function, is used for debugging output only
663 -- EXAMPLE USAGE: printIndent(2) -- Will print 2 spaces in output
664 if type(num) == "number" then
665 num = CVExtra.Math.round(num)
666 local i = 0
667 while (i < num) do
668 i = i + 1
669 if (i%2==0) then
670 print("")
671 else
672 print(" ")
673 end
674 end
675 end
676 end,
677 playAudio = function(aud,pbs,startime,endtime) -- WIP, FUNCTION BROKEN
678 -- EXAMPLE USAGE: playAudio(sound) -- Will play the specified sound. || playAudio(sound,1) -- Will play the specified sound at the specified playbackSpeed, 1 is normal || playAudio(sound,1,0,2) -- Will play the specified sound at the specified playbackSpeed at startTime "0" (default) and end at endTime "2"
679
680 -- SELF-DEPENDENT FUNCTION
681 local playAudio = CVExtra.playAudio
682 --[[ How to have a self-dependent function:
683 -- Define it before the function appears, shown below:
684
685 local functionOfChoice
686 local functionOfChoice = function()
687 functionOfChoice()
688 end
689 --]]
690 --
691 aud:Stop()
692
693 local beginStart = startime
694 local beginEnd = endtime
695 local beginPBS = pbs
696
697 local Start = aud:FindFirstChild("Start")
698 local End = aud:FindFirstChild("End")
699 local timeStart = 0
700 local totalLength = aud.TimeLength
701 local PBS = aud.PlaybackSpeed
702 local timeEnd = aud.TimeLength
703 local totalPlayTime = timeEnd - timeStart
704 local PBSLength = totalPlayTime/PBS
705 local elasped = timeStart
706 local espInc = 0.03 -- elasped increment
707 local function play()
708 aud.TimePosition = timeStart
709 aud:Play()
710 local ctp = 0
711 repeat --wait(math.ceil(PBSLength))
712 wait(0.1)
713 repeat
714 print("Why you yeeter my teeters")
715 wait(0.1)
716 until aud.isPaused == true
717 print("Bonzai")
718 if aud.TimePosition==0 and aud.Playing==false then
719 print("broke")
720 break
721 end
722 ctp=aud.TimePosition
723 until aud.TimePosition >= timeEnd
724 local goloop = false
725 if ctp>=timeEnd then
726 goloop=true
727 end
728 aud:Stop()
729 wait()
730 if aud.Looped == true and goloop==true then
731 playAudio(aud,beginPBS,beginStart,beginEnd)
732 end
733 end
734 local function PBSUpdate(p)
735 PBS = aud.PlaybackSpeed
736 timeEnd = timeEnd/PBS
737 end
738 aud.Changed:connect(PBSUpdate)
739 if type(pbs)=="number" then
740 PBS = pbs
741 end
742 if Start == nil then
743 if type(startime)=="number" then
744 timeStart = startime
745 end
746 else
747 if Start:IsA("NumberValue") and Start.Value < aud.TimeLength then
748 timeStart = Start.Value
749 end
750 end
751 if End == nil then
752 if type(endtime)=="number" then
753 timeEnd = endtime
754 end
755 else
756 if End:IsA("NumberValue") then
757 if End.Value > aud.TimeLength then
758 End.Value = aud.TimeLength
759 end
760 timeEnd = End.Value
761 end
762 end
763 totalPlayTime = (timeEnd/PBS/(1/PBS)) - (timeStart/PBS/(1/PBS))
764 elasped = timeStart
765 PBSLength = totalPlayTime
766 play()
767 end,
768 getPlayer = function(s) -- Use of function is intended for other CVExtra functions.
769 -- EXAMPLE USAGE: getPlayer("Cvieyra2test") -- Gets user of the string mentioned, returns nil if it cannot find them
770 local returnT = nil
771 local players = game:GetService("Players")
772 if type(s)=="string" then
773 for i,plr in pairs(players:GetPlayers()) do
774 if plr.Name == s then
775 returnT = plr
776 break
777 end
778 wait()
779 end
780 else
781 warn("getPlayer cannot get name from provided instance")
782 end
783 return returnT
784 end,
785 createleaderStats = function(plr)
786 -- EXAMPLE USAGE: createleaderStats("Cvieyra2test") -- Must requrie a player from game.Players. Although you can use a string in which the function will find a player in Players
787 local returnT = nil
788
789 -- REQUIRED FUNCTIONS
790 local getPlayer = CVExtra.getPlayer
791 --
792
793 if type(plr) == "string" then
794 plr = getPlayer(plr)
795 end
796 if typeof(plr) == "Instance" then
797 if plr:IsA("Player") then
798 local a = plr:FindFirstChild("leaderstats")
799 local function createLeaderStats()
800 local leaderstats = Instance.new("Model",plr)
801 leaderstats.Name = "leaderstats"
802 returnT = leaderstats
803 end
804 if a and a:IsA("Model") then
805 warn("createleaderStats: Found a pre-existing leaderstats!")
806 else
807 if a then
808 a.Parent = nil
809 createLeaderStats()
810 else
811 createLeaderStats()
812 end
813 end
814 else
815 warn("createleaderStats: Only provide a player, not a "..plr.ClassName)
816 end
817 else
818 warn("createleaderStats: Only provide an instance, not anything else!")
819 end
820 return returnT
821 end,
822 clean = function(con,specification,turbo) -- deletes empty 'specifications' of a container
823 -- EXAMPLE USAGE: clean(game.Workspace,model,false) -- would delete all instances of empty "models" in game.Workspace
824 local turboV = false -- either it does it quick or fast -- fast can cause lag but does it in a jiffy!
825
826 -- REQUIRED FUNCTIONS
827 local cap = CVExtra.capitalize
828 --
829
830 if type(turbo)=="boolean" then -- Also it must be specified true or false!
831 turboV = turbo
832 end
833 if type(specification)=="string" then
834 specification = cap(specification)
835 elseif typeof(specification)=="Instance" then
836 specification = specification.ClassName
837 end
838 if typeof(con)=="Instance" then
839 local b = Instance.new(specification)
840 if b then
841 local content = con:GetChildren()
842 for i,v in pairs(content) do
843 if #v:GetDescendants()==0 then
844 if v:IsA(specification) then
845 v.Parent = nil
846 end
847 end
848 if turboV == true then
849 else
850 wait()
851 end
852 end
853 else
854 warn("clean: Specified instance is not valid!")
855 end
856 else
857 warn("clean: Requires an instance to clean in!")
858 end
859 end,
860 cleanHats = function(turbo) -- Cleans hats in the workspace
861 -- EXAMPLE USAGE: cleanHats() -- Cleans all hats in the workspace in a slow, but non-laggy way || cleanHats(true) -- Cleans all hats in the workspace at a very fast, but potentially laggy way
862 local turboV = false
863 if type(turbo)=="boolean" then
864 turboV = turbo
865 end
866 local b = workspace:GetChildren()
867 for i,v in pairs(b) do
868 if v:IsA("Hat") or v:IsA("Accessory") then
869 v.Parent = nil
870 end
871 if turboV == true then
872 else
873 wait()
874 end
875 end
876 end,
877 areaOf = function(instance) -- Gets the area of an object (for a square, thus triangles or circles will not be calculated appropriately)
878 -- EXAMPLE USAGE: areaOf(workspace.Part) -- Will get the area of specified "Part" that is IF "Part" is a "BasePart" or "GUIObject" -- This will return the area of the two points that define the surface, X & Z which are described as base & length in this situation
879 local result = nil
880 -- REQUIRED FUNCTIONS
881 local area = CVExtra.Math.area
882 --
883
884 if typeof(instance)=="Instance" then
885 if instance:IsA("GuiObject") then
886 result = area(instance.Size.X,instance.Size.Y)
887 elseif instance:IsA("BasePart") then
888 result = area(instance.Size.X,instance.Size.Z)
889 else
890 warn("CVExtra.areaOf: instance is not a BasePart or GUIObject!")
891 end
892 end
893 return result
894 end,
895 volumeOf = function(instance) -- Gets the volume of an object (for a cube, thus triangular prisms or spheres will not be calculated appropriately)
896 -- EXAMPLE USAGE: volumeOf(workspace.Part) -- Will get the volume of specified "Part" that is IF "Part" is a "BasePart" -- This will return the volume of the three points that define the "Part," X, Z, & Y which are described as base, length & height in this situation
897 local result = nil
898 local result = nil
899
900 -- REQUIRED FUNCTIONS
901 local volume = CVExtra.Math.volume
902 --
903
904 if typeof(instance)=="Instance" then
905 if instance:IsA("BasePart") then
906 result = volume(instance.Size.X,instance.Size.Y,instance.Size.Z)
907 else
908 warn("CVExtra.volumeOf: instance is not a BasePart!")
909 end
910 end
911 return result
912 end,
913 colours = { -- Just custom colours. -- You can grab one by doing: colours.list.highlighter -- to get "Highlighter"
914 list = {
915 -- EXAMPLE USAGE: game.Workspace.Color = colours.list.trueorange -- Would colour the first object named "Part" in game.Workspace to "trueorange" (RGB: 255,100,0)
916
917 -- It is recommended you copy the entire colours table for colour functions to work, if you plan to
918 -- add to localscript
919
920 -- BASE ROBLOX GUI COLOURS
921 ["earth green"]=Color3.fromRGB(39,70,45),
922 ["slime green"]=Color3.fromRGB(80,109,84),
923 ["bright bluish green"]=Color3.fromRGB(0,143,156),
924 ["black"]=Color3.fromRGB(27,42,53),
925 ["deep blue"]=Color3.fromRGB(33,84,185),
926 ["dark blue"]=Color3.fromRGB(0,16,176),
927 ["navy blue"]=Color3.fromRGB(0,32,96),
928 ["parsley green"]=Color3.fromRGB(44,101,29),
929 ["dark green"]=Color3.fromRGB(40,127,71),
930 ["teal"]=Color3.fromRGB(18,238,212),
931 ["smoky grey"]=Color3.fromRGB(91,93,105),
932 ["steel blue"]=Color3.fromRGB(82,124,174),
933 ["storm blue"]=Color3.fromRGB(51,88,130),
934 ["lapis"]=Color3.fromRGB(16,42,220),
935 ["dark indigo"]=Color3.fromRGB(61,21,133),
936 ["camo"]=Color3.fromRGB(58,125,21),
937 ["sea green"]=Color3.fromRGB(52,142,64),
938 ["shamrock"]=Color3.fromRGB(91,154,76),
939 ["toothpaste"]=Color3.fromRGB(0,255,255),
940 ["sand blue"]=Color3.fromRGB(116,134,157),
941 ["medium blue"]=Color3.fromRGB(110,153,202),
942 ["bright blue"]=Color3.fromRGB(13,105,172),
943 ["really blue"]=Color3.fromRGB(0,0,255),
944 ["mulberry"]=Color3.fromRGB(89,34,89),
945 ["forest green"]=Color3.fromRGB(31,128,29),
946 ["bright green"]=Color3.fromRGB(75,151,75),
947 ["grime"]=Color3.fromRGB(127,142,100),
948 ["lime green"]=Color3.fromRGB(0,255,0),
949 ["pastel blue-green"]=Color3.fromRGB(159,243,233),
950 ["fossil"]=Color3.fromRGB(159,161,172),
951 ["electric blue"]=Color3.fromRGB(9,137,207),
952 ["lavender"]=Color3.fromRGB(140,91,159),
953 ["royal purple"]=Color3.fromRGB(98,37,209),
954 ["eggplant"]=Color3.fromRGB(123,0,123),
955 ["sand green"]=Color3.fromRGB(120,144,130),
956 ["moss"]=Color3.fromRGB(124,156,107),
957 ["artichoke"]=Color3.fromRGB(138,171,133),
958 ["sage green"]=Color3.fromRGB(185,196,177),
959 ["pastel light blue"]=Color3.fromRGB(175,221,255),
960 ["cadet blue"]=Color3.fromRGB(159,173,192),
961 ["cyan"]=Color3.fromRGB(4,175,236),
962 ["alder"]=Color3.fromRGB(180,128,255),
963 ["lilac"]=Color3.fromRGB(167,94,155),
964 ["plum"]=Color3.fromRGB(123,47,123),
965 ["bright violet"]=Color3.fromRGB(107,50,124),
966 ["olive"]=Color3.fromRGB(193,190,66),
967 ["br. yellowish green"]=Color3.fromRGB(164,189,71),
968 ["olivine"]=Color3.fromRGB(148,190,129),
969 ["laurel green"]=Color3.fromRGB(168,189,153),
970 ["quill grey"]=Color3.fromRGB(223,223,222),
971 ["ghost grey"]=Color3.fromRGB(202,203,209),
972 ["pastel blue"]=Color3.fromRGB(128,187,219),
973 ["pastel violet"]=Color3.fromRGB(177,167,255),
974 ["pink"]=Color3.fromRGB(255,102,204),
975 ["hot pink"]=Color3.fromRGB(255,0,191),
976 ["magenta"]=Color3.fromRGB(170,0,170),
977 ["crimson"]=Color3.fromRGB(151,0,0),
978 ["deep orange"]=Color3.fromRGB(255,176,0),
979 ["new yeller"]=Color3.fromRGB(255,255,0),
980 ["medium green"]=Color3.fromRGB(161,196,140),
981 ["mint"]=Color3.fromRGB(177,229,166),
982 ["pastel green"]=Color3.fromRGB(204,255,204),
983 ["light stone grey"]=Color3.fromRGB(229,228,223),
984 ["light blue"]=Color3.fromRGB(180,210,228),
985 ["baby blue"]=Color3.fromRGB(152,194,219),
986 ["carnation pink"]=Color3.fromRGB(255,152,220),
987 ["persimmon"]=Color3.fromRGB(255,89,89),
988 ["really red"]=Color3.fromRGB(255,0,0),
989 ["bright red"]=Color3.fromRGB(196,40,28),
990 ["maroon"]=Color3.fromRGB(117,0,0),
991 ["gold"]=Color3.fromRGB(239,184,56),
992 ["bright yellow"]=Color3.fromRGB(245,205,48),
993 ["daisy orange"]=Color3.fromRGB(248,217,109),
994 ["cool yellow"]=Color3.fromRGB(253,234,141),
995 ["pastel yellow"]=Color3.fromRGB(255,255,204),
996 ["pearl"]=Color3.fromRGB(231,231,236),
997 ["fog"]=Color3.fromRGB(199,212,228),
998 ["mauve"]=Color3.fromRGB(224,178,208),
999 ["sunrise"]=Color3.fromRGB(212,144,189),
1000 ["terra cotta"]=Color3.fromRGB(190,104,98),
1001 ["dusty rose"]=Color3.fromRGB(163,75,75),
1002 ["cocoa"]=Color3.fromRGB(86,36,36),
1003 ["neon orange"]=Color3.fromRGB(213,115,61),
1004 ["bright orange"]=Color3.fromRGB(218,133,65),
1005 ["wheat"]=Color3.fromRGB(241,231,199),
1006 ["buttermilk"]=Color3.fromRGB(254,243,187),
1007 ["institutional white"]=Color3.fromRGB(248,248,248),
1008 ["white"]=Color3.fromRGB(242,243,243),
1009 ["light reddish violet"]=Color3.fromRGB(232,186,200),
1010 ["pastel orange"]=Color3.fromRGB(255,101,201),
1011 ["salmon"]=Color3.fromRGB(255,148,148),
1012 ["tawny"]=Color3.fromRGB(150,85,85),
1013 ["rust"]=Color3.fromRGB(143,76,42),
1014 ["cga brown"]=Color3.fromRGB(170,85,0),
1015 ["br. yellowish orange"]=Color3.fromRGB(226,155,64),
1016 ["cashmere"]=Color3.fromRGB(211,190,150),
1017 ["khaki"]=Color3.fromRGB(226,220,188),
1018 ["lily white"]=Color3.fromRGB(237,234,234),
1019 ["seashell"]=Color3.fromRGB(233,218,218),
1020 ["pastel brown"]=Color3.fromRGB(255,204,153),
1021 ["light orange"]=Color3.fromRGB(234,184,146),
1022 ["medium red"]=Color3.fromRGB(218,134,122),
1023 ["burgundy"]=Color3.fromRGB(136,62,62),
1024 ["reddish brown"]=Color3.fromRGB(105,64,40),
1025 ["cork"]=Color3.fromRGB(188,155,93),
1026 ["burlap"]=Color3.fromRGB(199,172,120),
1027 ["beige"]=Color3.fromRGB(202,191,163),
1028 ["oyster"]=Color3.fromRGB(187,179,178),
1029 ["mid gray"]=Color3.fromRGB(205,205,205),
1030 ["brick yellow"]=Color3.fromRGB(215,197,154),
1031 ["nougat"]=Color3.fromRGB(204,142,105),
1032 ["brown"]=Color3.fromRGB(124,92,70),
1033 ["pine cone"]=Color3.fromRGB(108,88,75),
1034 ["fawn brown"]=Color3.fromRGB(160,132,79),
1035 ["sand red"]=Color3.fromRGB(149,121,119),
1036 ["hurricane grey"]=Color3.fromRGB(149,137,136),
1037 ["cloudy grey"]=Color3.fromRGB(171,168,158),
1038 ["linen"]=Color3.fromRGB(175,148,131),
1039 ["copper"]=Color3.fromRGB(150,103,102),
1040 ["dark orange"]=Color3.fromRGB(160,95,53),
1041 ["dirt brown"]=Color3.fromRGB(86,66,54),
1042 ["bronze"]=Color3.fromRGB(126,104,63),
1043 ["dark stone grey"]=Color3.fromRGB(99,95,98),
1044 ["medium stone grey"]=Color3.fromRGB(163,162,165),
1045 ["flint"]=Color3.fromRGB(105,102,92),
1046 ["dark taupe"]=Color3.fromRGB(90,76,66),
1047 ["burnt sienna"]=Color3.fromRGB(106,57,9),
1048 ["really black"]=Color3.fromRGB(17,17,17),
1049 -- OTHER BASE ROBLOX COLOURS
1050 ["light orange brown"]=Color3.fromRGB(203,132,66),
1051 ["med. reddish violet"]=Color3.fromRGB(196,112,160),
1052 ["earth orange"]=Color3.fromRGB(98,71,50),
1053 ["lig. yellowich orange"]=Color3.fromRGB(243,207,155),
1054 ["light bluish violet"]=Color3.fromRGB(193,202,222),
1055 ["transparent"]=Color3.fromRGB(236,236,236),
1056 ["tr. red"]=Color3.fromRGB(205,84,75),
1057 ["tr. lg blue"]=Color3.fromRGB(193,223,240),
1058 ["tr. yellow"]=Color3.fromRGB(247,241,141),
1059 ["tr. flu. reddish orange"]=Color3.fromRGB(217,133,108),
1060 ["tr. green"]=Color3.fromRGB(132,182,141),
1061 ["tr. flu. green"]=Color3.fromRGB(248,241,132),
1062 ["phosph. white"]=Color3.fromRGB(236,232,222),
1063 ["light red"]=Color3.fromRGB(238,196,182),
1064 ["earth yellow"]=Color3.fromRGB(104,92,67),
1065 ["bright bluish violet"]=Color3.fromRGB(67,84,147),
1066 ["tr. brown"]=Color3.fromRGB(191,183,177),
1067 ["medium bluish violet"]=Color3.fromRGB(104,116,172),
1068 ["tr. medi. reddish violet"]=Color3.fromRGB(229,173,200),
1069 ["med. yellowish green"]=Color3.fromRGB(199,210,60),
1070 ["med. bluish green"]=Color3.fromRGB(85,165,175),
1071 ["light bluish green"]=Color3.fromRGB(183,215,213),
1072 ["lig. yellowish green"]=Color3.fromRGB(217,228,167),
1073 ["med. yellowish orange"]=Color3.fromRGB(231,172,88),
1074 ["br. reddish orange"]=Color3.fromRGB(211,111,76),
1075 ["bright reddish violet"]=Color3.fromRGB(146,57,120),
1076 ["tr. bright bluish violet"]=Color3.fromRGB(165,165,203),
1077 ["dark nougat"]=Color3.fromRGB(174,122,89),
1078 ["silver"]=Color3.fromRGB(156,163,168),
1079 ["neon green"]=Color3.fromRGB(216,221,86),
1080 ["sand violet"]=Color3.fromRGB(135,124,144),
1081 ["medium orange"]=Color3.fromRGB(224,152,100),
1082 ["sand yellow"]=Color3.fromRGB(149,138,115),
1083 ["earth blue"]=Color3.fromRGB(32,58,86),
1084 ["tr. flu. blue"]=Color3.fromRGB(207,226,247),
1085 ["sand blue metallic"]=Color3.fromRGB(121,136,161),
1086 ["sand violet metallic"]=Color3.fromRGB(149,142,163),
1087 ["sand yellow metallic"]=Color3.fromRGB(147,135,103),
1088 ["dark grey metallic"]=Color3.fromRGB(87,88,87),
1089 ["black metallic"]=Color3.fromRGB(22,29,50),
1090 ["light grey metallic"]=Color3.fromRGB(171,173,172),
1091 ["dark red"]=Color3.fromRGB(123,46,47),
1092 ["tr. flu yellow"]=Color3.fromRGB(255,246,123),
1093 ["tr. flu. red"]=Color3.fromRGB(225,164,194),
1094 ["gun metallic"]=Color3.fromRGB(117,108,98),
1095 ["red flip/flop"]=Color3.fromRGB(151,105,91),
1096 ["yellow flip/flop"]=Color3.fromRGB(180,132,85),
1097 ["silver flip/flop"]=Color3.fromRGB(137,135,136),
1098 ["curry"]=Color3.fromRGB(215,169,75),
1099 ["fire yellow"]=Color3.fromRGB(249,214,46),
1100 ["flame yellowish orange"]=Color3.fromRGB(232,171,45),
1101 ["flame reddish orange"]=Color3.fromRGB(207,96,36),
1102 ["royal blue"]=Color3.fromRGB(70,103,164),
1103 ["dark royal blue"]=Color3.fromRGB(35,71,139),
1104 ["bright reddish lilac"]=Color3.fromRGB(9142,66,133),
1105 ["lemon metallic"]=Color3.fromRGB(130,138,93),
1106 ["dark curry"]=Color3.fromRGB(176,142,68),
1107 ["faded green"]=Color3.fromRGB(112,149,120),
1108 ["turquoise"]=Color3.fromRGB(121,181,181),
1109 ["light royal blue"]=Color3.fromRGB(159,195,233),
1110 ["medium royal blue"]=Color3.fromRGB(108,129,183),
1111 ["reddish lilac"]=Color3.fromRGB(150,112,159),
1112 ["light lilac"]=Color3.fromRGB(167,169,206),
1113 ["bright purple"]=Color3.fromRGB(205,98,152),
1114 ["light purple"]=Color3.fromRGB(228,173,200),
1115 ["light pink"]=Color3.fromRGB(220,144,149),
1116 ["light brick yellow"]=Color3.fromRGB(240,213,160),
1117 ["warm yellowish orange"]=Color3.fromRGB(235,184,127),
1118 ["dove blue"]=Color3.fromRGB(125,187,221),
1119 ["medium lilac"]=Color3.fromRGB(52,43,117),
1120 -- ABSOLUTE COLOURS
1121 ["red"]=Color3.fromRGB(255,0,0),
1122 ["green"]=Color3.fromRGB(0,255,0),
1123 ["blue"]=Color3.fromRGB(0,0,255),
1124 ["yellow"]=Color3.fromRGB(255,255,0),
1125 ["purple"]=Color3.fromRGB(255,0,255),
1126 ["absolute black"]=Color3.fromRGB(0,0,0),
1127 ["absolute white"]=Color3.fromRGB(255,255,255),
1128 -- CV CUSTOM COLOURS
1129 ["red orange"] = Color3.fromRGB(255,70,0), -- Red-Based
1130 ["pumpkin orange"] = Color3.fromRGB(255,90,0), -- Red-Based
1131 ["trueorange"] = Color3.fromRGB(255,100,0), -- Red-Based
1132 ["highlighter"] = Color3.fromRGB(220, 255, 0), -- Yellow-Based
1133 ["cucumber"] = Color3.fromRGB(78,101,74), -- Green-Based
1134 ["pyrite"] = Color3.fromRGB(138,125,94), -- Brown
1135 ["firebrick"] = Color3.fromRGB(178,34,34), -- Red-Based
1136 ["soapgreen"]=Color3.fromRGB(0,255,127), -- Green-Based
1137 ["fluorescent butter"]=Color3.fromRGB(255,246,123), -- Yellow-based
1138 ["pupil"]=Color3.fromRGB(4,4,6), -- Grey-Black
1139 ["mediterranean"]=Color3.fromRGB(70,190,200), -- Blue-Based
1140 ["slate grey"]=Color3.fromRGB(112,128,144), -- Grey-Black
1141 ["light vanilla"]=Color3.fromRGB(255,254,221), -- Yellow-Based
1142 ["grapefruit"]=Color3.fromRGB(229,58,55), -- Red-Based
1143 ["caramel"]=Color3.fromRGB(185,93,1), -- Brown
1144 ["carpetberry"]=Color3.fromRGB(94,40,52), -- Red-Based
1145 ["butter"]=Color3.fromRGB(230,220,111), -- Yellow-Based
1146 ["mango"]=Color3.fromRGB(253,171,0), -- Red-Based
1147 ["chocolate"]=Color3.fromRGB(105,64,20), -- Brown
1148 ["peach"]=Color3.fromRGB(255,134,48), -- Red-Based
1149 ["grass"]=Color3.fromRGB(0,170,0), -- Green-Based
1150 ["cantaloupe"]=Color3.fromRGB(243,117,60), -- Red-Based
1151 ["light tomato"]=Color3.fromRGB(242,74,45), -- Red-Based
1152 ["ketchup"]=Color3.fromRGB(173,0,11), -- Red-Based
1153 ["cayenne"]=Color3.fromRGB(192,41,24), -- Red-Based
1154 ["taco spice"]=Color3.fromRGB(214,114,64), -- Red-Based
1155 ["olive oil"]=Color3.fromRGB(213,176,39), -- Yellow-Based
1156 ["jalapeno"]=Color3.fromRGB(104,179,24), -- Green-Based
1157 ["leaf"]=Color3.fromRGB(84,148,36), -- Green-Based
1158 ["green glow goo"]=Color3.fromRGB(146,255,62), -- Green-Based
1159 ["sewer"]=Color3.fromRGB(170,191,114), -- Green-Based
1160 ["dark lush green"]=Color3.fromRGB(26,119,86), -- Green-Based
1161 ["lush green"]=Color3.fromRGB(30,175,78), -- Green-Based
1162 ["dark cash green"]=Color3.fromRGB(14,66,48), -- Green-Based
1163 ["blue metallic"]=Color3.fromRGB(21,24,71), -- Blue-Based
1164 ["lipstick"]=Color3.fromRGB(179,18,51), -- Red-Based
1165 ["taint tawny"]=Color3.fromRGB(134,82,93), -- Red-Based
1166 ["diarylide"]=Color3.fromRGB(255,164,0), -- Yellow-Based
1167 ["quin. burnt orange"]=Color3.fromRGB(81,32,29), -- Red-Based
1168 ["dioxazine purple"]=Color3.fromRGB(40,31,29), -- Purple-Brown
1169 ["manganese blue"]=Color3.fromRGB(0,75,131), -- Blue-Based
1170 ["gum"]=Color3.fromRGB(255,75,128), -- Red-Based
1171 ["pewter"]=Color3.fromRGB(107,107,99), -- Brown
1172 ["coral sands"]=Color3.fromRGB(236,170,135), -- Brown
1173 ["latte"]=Color3.fromRGB(164,129,97), -- Brown
1174 ["venison"]=Color3.fromRGB(139,51,49), -- Red-Based
1175 ["vanilla"]=Color3.fromRGB(245,247,167), -- Yellow-Based
1176 ["tropical mediterranean"]=Color3.fromRGB(46,203,168) -- Blue-Based
1177 },
1178 addColour = function(cname,rgb) -- Adds a customized colour to the colours table, returns colour's RGB back to what called function
1179 -- EXAMPLE USAGE: addColour("slategrey2",Color3.fromRGB(112,128,144)) -- This will input "slategrey2" into colours with RGB code: 112,128,144 -- Although if you input a pre-existing RGB value, all you need to do is -- addColour("slategrey2",nameofRGB)
1180 local result = nil
1181 local rgbnew = Color3.fromRGB(rgb)
1182 local colours = CVExtra.colours.list
1183 if type(cname)=="string" then
1184 cname = cname:lower()
1185 if colours[cname] == nil then
1186 colours[cname] = rgbnew
1187 result = colours[cname]
1188 else
1189 warn("CVExtra.colours.addColour: Colour already exists in CVExtra.colours!")
1190 end
1191 end
1192 return result
1193 end,
1194 getColour = function(s) -- Gets a colour from list if the provided string is a name found in the list
1195 -- EXAMPLE USAGE: getColour("pupil") -- Will return the colour of "pupil" in RGB
1196 local result = nil
1197
1198 -- REQUIRED FUNCTIONS/TABLES
1199 local colours = CVExtra.colours.list
1200 local round = CVExtra.Math.round
1201 local getList = CVExtra.colours.getList
1202 --
1203
1204 if type(s) == "string" then
1205 s = s:lower()
1206 if colours[s] then
1207 result = colours[s]
1208 else
1209 warn("CVExtra.colours.getColour: Couldn't find colour: "..s.."!")
1210 end
1211 elseif type(s)=="number" then
1212 if round(s)>0 then
1213 local list = getList()
1214 local picked = list[s]
1215 if picked then
1216 local colour = colours[picked]
1217 return colour,picked
1218 else
1219 warn("CVExtra.colours.getColour: Couldn't find colour of iteration: "..s.."!")
1220 end
1221 end
1222 end
1223 return result
1224 end,
1225 darken = function(rgb,amount) -- Amount must range from 0-100!
1226 local result = nil
1227 if type(amount)=="number" then
1228 if typeof(rgb)=="Color3" then
1229 local amountd = amount/100
1230 local HSVt = {0,0,0}
1231 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
1232 HSVt[3]=HSVt[3]-amountd
1233 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
1234 if HSVt[3]-amountd>0 and HSVt[3]-amountd<=1 then
1235
1236 elseif HSVt[3]-amountd<=0 then
1237 HSV = Color3.fromHSV(HSVt[1],HSVt[2],0)
1238 elseif HSVt[3]-amountd>1 then
1239 HSVt[3]=1
1240 HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
1241 end
1242 result = HSV
1243 end
1244 end
1245 return result
1246 end,
1247 lighten = function(rgb,amount) -- Amount must range from 0-100!
1248 local result = nil
1249
1250 -- REQUIRED FUNCTIONS
1251 local inverse = CVExtra.Math.inverse
1252 local darken = CVExtra.colours.darken
1253 --
1254
1255 result = darken(rgb,inverse(amount))
1256 return result
1257 end,
1258 desaturate = function(rgb,amount) -- Amount must range from 0-100!
1259 local result = nil
1260 if type(amount)=="number" then
1261 if typeof(rgb)=="Color3" then
1262 local amountd = amount/100
1263 local HSVt = {0,0,0}
1264 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
1265 HSVt[2]=HSVt[2]-amountd
1266 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
1267 if HSVt[2]-amountd>0 and HSVt[2]-amountd<=1 then
1268
1269 elseif HSVt[2]-amountd<=0 then
1270 HSV = Color3.fromHSV(HSVt[1],0,HSVt[3])
1271 elseif HSVt[2]-amountd>1 then
1272 HSVt[2]=1
1273 HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
1274 end
1275 result = HSV
1276 end
1277 end
1278 return result
1279 end,
1280 saturate = function(rgb,amount) -- Amount must range from 0-100!
1281 local result = nil
1282
1283 -- REQUIRED FUNCTIONS
1284 local inverse = CVExtra.Math.inverse
1285 --
1286
1287 local saturate = CVExtra.colours.desaturate
1288 result = saturate(rgb,inverse(amount))
1289 return result
1290 end,
1291 Color3fromHex = function(hex) -- A function that CloneTrooper1019 made a while back in Feb, 2016, check: https://devforum.roblox.com/t/color3-fromhsv-h-s-v/22114/3
1292 local r = math.floor(hex/65536)%256
1293 local g = math.floor(hex/256)%256
1294 local b = math.floor(hex%256)
1295 return Color3.new(r/255,g/255,b/255)
1296 end,
1297 Color3fromVector3 = function(v3)
1298 local result
1299 if typeof(v3)=="Vector3" then
1300 local vec = Vector3.new(v3.X,v3.Y,v3.Z)
1301 local v0 = vec.X
1302 local v1 = vec.Y
1303 local v2 = vec.Z
1304 if v0>1 then
1305 v0=1
1306 end
1307 if v1>1 then
1308 v1=1
1309 end
1310 if v2>1 then
1311 v2=1
1312 end
1313 local color = Color3.new(v0,v1,v2)
1314 result = color
1315 end
1316 return result
1317 end,
1318 Color3toRGB = function(color3)
1319 local result
1320 local r
1321 local g
1322 local b
1323 if typeof(color3)=="Color3" then
1324 if color3.r<=1 and color3.g<=1 and color3.b<=1 then
1325 r = math.floor(color3.r*255)
1326 g = math.floor(color3.g*255)
1327 b = math.floor(color3.b*255)
1328 end
1329 end
1330 return r,g,b
1331 end,
1332 Color3toCMYK = function(color3) -- WIP
1333 -- https://www.rapidtables.com/convert/color/rgb-to-cmyk.html
1334 local result
1335 if typeof(color3)=="Color3" then
1336 local RGB = {color3.r,color3.g,color3.b}
1337 local maxV = math.min(RGB[1],RGB[2],RGB[3])
1338 local k=1-maxV
1339 print(k)
1340 if math.sign(k)==-1 or math.sign(k)==0 then
1341 k=0
1342 end
1343 local c=(1-RGB[1]-k)/(1-k)
1344 print(c)
1345 if math.sign(c)==-1 or math.sign(c)==0 then
1346 c=0
1347 end
1348 local m=(1-RGB[2]-k)/(1-k)
1349 print(m)
1350 if math.sign(m)==-1 or math.sign(m)==0 then
1351 m=0
1352 end
1353 local y=(1-RGB[3]-k)/(1-k)
1354 print(y)
1355 if math.sign(y)==-1 or math.sign(y)==0 then
1356 y=0
1357 end
1358 result = {c,m,y,k}
1359 end
1360 if result~=nil then
1361 return unpack(result)
1362 else
1363 return result
1364 end
1365 end,
1366 Color3fromCMYK = function(c,m,y,k)
1367 local result
1368 local isCMYK=true
1369 if type(c)=="table" then
1370 if #c>4 then
1371 m=c[2]
1372 y=c[3]
1373 k=c[4]
1374 c=c[1]
1375 end
1376 end
1377 if type(c)=="number" and type(m)=="number" and type(y)=="number" and type(k)=="number" then
1378 if (math.sign(c)==0 or math.sign(c)==1 and c<=1) then
1379 else
1380 isCMYK=false
1381 end
1382 if (math.sign(m)==0 or math.sign(m)==1 and m<=1) then
1383 else
1384 isCMYK=false
1385 end
1386 if (math.sign(y)==0 or math.sign(y)==1 and y<=1) then
1387 else
1388 isCMYK=false
1389 end
1390 if (math.sign(k)==0 or math.sign(k)==1 and k<=1) then
1391 else
1392 isCMYK=false
1393 end
1394 else
1395 isCMYK=false
1396 end
1397 if isCMYK==true then
1398 print(c-1,m-1,y-1,k-1)
1399 local r=255*(1-c)*(1-k)
1400 local g=255*(1-m)*(1-k)
1401 local b=255*(1-y)*(1-k)
1402 print(r)
1403 print(g)
1404 print(b)
1405 r=r/255
1406 g=g/255
1407 b=b/255
1408 print(r)
1409 print(g)
1410 print(b)
1411 local newCol=Color3.new(r,g,b)
1412 result = newCol
1413 end
1414 return result
1415 end,
1416 getList = function()
1417 local result = nil
1418
1419 -- REQUIRED FUNCTIONS/TABLES
1420 local list = CVExtra.colours.list
1421 local cap = CVExtra.capitalize
1422 --
1423
1424 local names = {}
1425 for name,val in pairs(list) do
1426 table.insert(names,name)
1427 end
1428 result = names
1429 return result
1430 end,
1431 random = function()
1432
1433 -- REQUIRED FUNCTIONS/TABLES
1434 local list = CVExtra.colours.list
1435 local glist = CVExtra.colours.getList()
1436 --
1437
1438 local listl = #glist
1439 local iter = math.random(1,listl)
1440 local c = glist[iter]
1441 local cc = list[c]
1442 return cc,c
1443 end,
1444 absoluterandom = function()
1445 local result
1446 result = Color3.new(math.random(),math.random(),math.random())
1447 return result
1448 end,
1449 colourMix = function(color1, color2) -- Provided by SinisterMemories (https://www.roblox.com/users/39939779/profile)
1450 local result
1451 if typeof(color1)=="Color3" and typeof(color2)=="Color3" then
1452 local mag = 0.5
1453 local color3 = Color3.new(
1454 (color1.r + color2.r) * mag,
1455 (color1.g + color2.g) * mag,
1456 (color1.b + color2.b) * mag)
1457 result = color3
1458 end
1459 return result
1460 end,
1461 },
1462 getChar = function(s,iterator) -- Gets a char from a string and the specified iteration of the string
1463 -- EXAMPLE USAGE: getChar("Galtus",2) -- Would get the 2nd iteration of the string, in this case, "a" from "Galtus"
1464 local result = nil
1465 if type(s)=="string" then
1466 result = (s.sub(s,iterator,iterator))
1467 elseif type(s)=="number" then
1468 s = ""+s
1469 result = (s.sub(s,iterator,iterator))
1470 end
1471 return result
1472 end,
1473 decimalPointLength = function(num) -- Gets the amount of characters after the decimal point
1474 -- EXAMPLE USAGE: decimalPointLength(1.435) -- Will return 3, since that's how many numbers are after the decimal points. || decimalPointLength(1.450) -- Will return 2, since "0" gets removed by number logic
1475 local result = nil
1476
1477 -- REQUIRED FUNCTIONS
1478 local numbify = CVExtra.numbify
1479 local getChar = CVExtra.getChar
1480 --
1481
1482 local tnum = 0
1483 local wholelength = 0
1484 local decimallength = 0
1485 local confirmed = false
1486 if type(num)=="number" then
1487 tnum = num
1488 confirmed = true
1489 elseif type(num)=="string" then
1490 tnum = numbify(num)
1491 confirmed = true
1492 end
1493 if confirmed==true then
1494 local i = 1
1495 local anum = ""..tnum
1496 local match = "%.+"
1497 repeat
1498 i = i+1
1499 until (i>=string.len(anum)) or getChar(anum,i)=="."
1500 wholelength = i
1501 decimallength = string.len(anum)-wholelength
1502 if decimallength<0 then
1503 decimallength=0
1504 end
1505 result = decimallength
1506 end
1507 return result
1508 end,
1509 power10 = function(num) -- Gets 10 multiplied by 10 by how many numbers are provided (rounded) -- "power"
1510 -- EXAMPLE USAGE: power10(2) -- Will return "100" since 10 to the power of 2 is 100, 10*10 (2 10's) = 100
1511
1512 -- INTENDED FOR MODULE SCRIPT USAGE, NOT ACTUALLY FOR OTHER SCRIPTS (Can be done with num^10 alternatively)
1513 local result = nil
1514
1515 -- REQUIRED FUNCTIONS
1516 local round = CVExtra.Math.round
1517 --
1518
1519 if type(num)=="number" then
1520 num = round(num)
1521 local i = 1
1522 local power = 1
1523 while (i<=num) do
1524 power = power*10
1525 i = i+1
1526 end
1527 result = power
1528 end
1529 return result
1530 end,
1531 mathrandom = function(num1,num2,round) -- Returns a randomnized number, accepts decimal points unlike Roblox's math.random
1532 -- EXAMPLE USAGE: mathrandom(1,2.5) will return a randomnized number between 1 & 2.5, with a tenth decimal point (0.1) || mathrandom(1,2.5) -- Will return a rounded, randomnized number between 1 & 2.5
1533 local result = nil
1534
1535 -- REQUIRED FUNCTIONS
1536 local getDPL = CVExtra.decimalPointLength
1537 local round = CVExtra.Math.round
1538 local power10 = CVExtra.power10
1539 --
1540
1541 local dplength = 0
1542 if type(num1)=="number" and type(num2)=="number" then
1543 if getDPL(num1)>getDPL(num2) then
1544 dplength = getDPL(num1)
1545 elseif getDPL(num1)<getDPL(num2) then
1546 dplength = getDPL(num2)
1547 else
1548 dplength = getDPL(num1)
1549 end
1550 local totime = power10(dplength)
1551 local rnum = math.random(num1*totime,num2*totime)
1552 result = rnum/totime
1553 end
1554 return result
1555 end,
1556 GetAllChildren = function(instance,turbo) -- Gets ALL children of an instance and returns them!
1557 -- EXAMPLE USAGE: GetAllChildren(game.Workspace) -- Will return EVERY single child in the ENTIRETY of the workspace!
1558 local result = nil
1559 local children = {}
1560 local function getChildren(obj)
1561 local am = obj:GetChildren()
1562 local bm
1563 if #am>0 then
1564 for i,v in pairs(am) do
1565 table.insert(children,v)
1566 bm = v:GetChildren()
1567 if #bm>0 then
1568 getChildren(v)
1569 end
1570 if turbo == true then
1571
1572 else
1573 wait()
1574 end
1575 end
1576 end
1577 end
1578 if typeof(instance)=="Instance" then
1579 getChildren(instance)
1580 else
1581 warn("CVExtra.GetAllChildren: an instance must be provided!")
1582 end
1583 if #children>=1 then
1584 result = children
1585 end
1586 return result
1587 end,
1588 antivirus = function() -- Uses a set amount of places to check for rogue scripts using a defined list of rogue scripts, then moves them to a new folder for the user to delete, repurpose or bring back
1589 -- EXAMPLE USAGE: antivirus() -- Will check numerous places for rogue scripts and place them in "CVVirus" below the extent of workspace in "Explorer." Anti-Virus returns the folder for scripts to utilize
1590 local result = nil
1591 local places = {workspace,game.Players,game.Lighting,game.ReplicatedFirst,game.ReplicatedStorage,game.ServerScriptService,game.ServerStorage,game.StarterGui,game.StarterPack,game.StarterPlayer,game.SoundService,game.Chat,game.LocalizationService}
1592 local lookfor = {"Infected","Anti-Lag","Hack","Virus","Hidden","ROFL","4D Being","Guest Free Chat Script","Guest_Talking_Script","Spreadify","Kill tem!","join teh moovment!","Wormed","Trashed","asdf","Anti-Lag2","Antivirus","Lolzorz","Guest Talking Script","soz i herd u lik mudkipz","Nice little scripty","Harmless little scripty","OH SNAP YOU GOT INFECTED XD XD XD","Spread","spread","YOU GOT INFECTED XD XD XD","virus","INfecTION","Vaccine","IsInfected","ViVrus","d��������������ng.........you got owned...","Kraftyisback","ThisScriptIsAJumpStartToAHe�lthyLifestyle","I am a friendly virus","micolord","ProperGr�mmerNeededInPhilosiphalLocations;insertNoobHere","FreeStyleM�yGoAnywhereIfNeeded","ANTIVIRISIS","ANTIVIRIS","FeelFreeToIns3rtGramm�tic�lErrorsHere","NoNoIDon'tNeedAllOfYourAwkw�rdSovietArguments","Script......Or is it...","Chaotic",[[""''""''""�|`�]]}
1593 local virusf = Instance.new("Folder")
1594 virusf.Name = "CVViruses"
1595 local virustat = Instance.new("StringValue")
1596 virustat.Name = "Virus Destination"
1597 local virusesfound = {}
1598 local wiq = game:FindFirstChild("CVViruses")
1599 if wiq then
1600 virusf = wiq
1601 end
1602 for i,h in pairs(places) do
1603 virusesfound[i] = 0
1604 end
1605 local virustotal = 0
1606 local GAC = CVExtra.GetAllChildren
1607 warn("CVExtra.antivirus: Scan initiated!")
1608 local de = 1
1609 for i,p in pairs(places) do
1610 local c = GAC(p,true)
1611 local e = 0
1612 if c==nil then
1613
1614 else
1615 warn("CVExtra.antivirus: Scanning "..p.Name)
1616
1617 local new = 0
1618 local newf = Instance.new("Folder")
1619 for i,v in pairs(c) do
1620 if v:IsA("BaseScript") then
1621 for i,a in pairs(lookfor) do
1622 if v.Name:lower()==a:lower() then
1623 v.Disabled = true
1624 if v:FindFirstChild("Virus Destination")==nil then
1625 local sod = virustat:clone()
1626 sod.Value = v:GetFullName()
1627 sod.Parent = v
1628 end
1629 v.Parent = newf
1630 end
1631 end
1632 else
1633
1634 end
1635 end
1636 local ak = newf:GetChildren()
1637 e = #ak
1638 virusesfound[de] = e
1639 for i,q in pairs(ak) do
1640 q.Parent = virusf
1641 end
1642 virustotal = virustotal+e
1643 warn("CVExtra.antivirus: "..e.." virus(es) found in "..p.Name)
1644 print("")
1645 print(" ")
1646 e = 0
1647 de = de+1
1648 wait()
1649 end
1650 end
1651 virusf.Parent = game
1652 result = virusf
1653 warn("CVExtra.antivirus: "..virustotal.." virus(es) were found in your place!")
1654 return result
1655 end,
1656 isodd = function(num) -- Tells if a number is odd or even *--* iseven can be used alternatively
1657 -- EXAMPLE USAGE: isodd(num) -- Returns string, "even" or "odd" if it is even or odd || iseven(num) -- works alternatively
1658 local result = nil
1659 if type(num)=="number" then
1660 if num%2==0 then
1661 result = "even"
1662 elseif num%2==1 then
1663 result = "odd"
1664 end
1665 else
1666
1667 end
1668 return result
1669 end,
1670 iseven = function(num)
1671
1672 -- REQUIRED FUNCTIONS
1673 local isodd = CVExtra.isodd
1674 --
1675
1676 local result
1677 result = isodd(num)
1678 return result
1679 end,
1680 toCharList = function(s) -- Turns a string into a list of characters
1681 -- EXAMPLE USAGE: toCharList("Dawrus") -- Will get every character of the provided string, then return it as a table of characters
1682 local result = nil
1683
1684 -- REQUIRED FUNCTIONS
1685 local getChar = CVExtra.getChar
1686 --
1687
1688 local charlist = {}
1689 if type(s)=="string" then
1690 local i = 1
1691 while (i<=s:len()) do
1692 charlist[i] = getChar(s,i)
1693 i = i+1
1694 end
1695 result = charlist
1696 end
1697 return result
1698 end,
1699 charlistToString = function(t) -- Turns a table back into a string as long as the iterated part of table is a string itself (intended as a reverse to "toCharList")
1700 -- EXAMPLE USAGE: charlistToString({"A","v","e","r","y"}) -- Will create a string using the items specified in the table, ignoring non-string
1701 local result = nil
1702 if type(t)=="table" then
1703 local String = ""
1704 for i,v in pairs(t) do
1705 if type(v)=="string" then
1706 String = String..v
1707 end
1708 end
1709 if String:len()>0 then
1710 result = String
1711 else
1712
1713 end
1714 end
1715 return result
1716 end,
1717 conversion = { -- Metric & Imperial measurements
1718
1719 -- IF COPYING TO LOCALSCRIPT, COPY ENTIRE CONVERSIONS TABLE
1720
1721 addTo = function()
1722
1723 -- REQUIRED FUNCTIONS/TABLES
1724 local conversion = CVExtra.conversion
1725 local length = conversion.length
1726 local liquid = conversion.liquid
1727 local Time = conversion.time
1728 local temp = conversion.temp
1729 local lenconversions = length.conversions
1730 local liqconversions = liquid.conversions
1731 local timeconversions = Time.conversions
1732 local tempconversions = temp.conversions
1733 --
1734
1735 if lenconversions["mm"] then
1736
1737 else
1738 lenconversions["mm"]=(lenconversions.millimetre)
1739 lenconversions["millimetres"]=(lenconversions.millimetre)
1740 lenconversions["millimeter"]=(lenconversions.millimetre)
1741 lenconversions["millimeters"]=(lenconversions.millimetre)
1742 length["toMillimeters"]=(length.toMillimetres)
1743 wait()
1744 lenconversions["centimetres"]=(lenconversions.centimetre)
1745 lenconversions["centimeter"]=(lenconversions.centimetre)
1746 lenconversions["centimeters"]=(lenconversions.centimetre)
1747 lenconversions["cm"]=(lenconversions.centimetre)
1748 length["toCentimeters"]=(length.toCentimetres)
1749 wait()
1750 lenconversions["decimetres"]=(lenconversions.decimetre)
1751 lenconversions["decimeter"]=(lenconversions.decimetre)
1752 lenconversions["decimeters"]=(lenconversions.decimetre)
1753 lenconversions["dm"]=(lenconversions.decimetre)
1754 length["toDecimeters"]=(length.toDecimetres)
1755 wait()
1756 lenconversions["metres"]=(lenconversions.metre)
1757 lenconversions["meter"]=(lenconversions.metre)
1758 lenconversions["meters"]=(lenconversions.metre)
1759 lenconversions["m"]=(lenconversions.metre)
1760 length["toMeters"]=(length.toMeters)
1761 wait()
1762 lenconversions["studs"]=(lenconversions.stud)
1763 wait()
1764 lenconversions["km"]=(lenconversions.kilometre)
1765 lenconversions["kilometres"]=(lenconversions.kilometre)
1766 lenconversions["kilometer"]=(lenconversions.kilometre)
1767 lenconversions["kilometers"]=(lenconversions.kilometre)
1768 length["toKilometers"]=(length.toKilometers)
1769 wait()
1770 lenconversions["inches"]=(lenconversions.inch)
1771 lenconversions["in"]=(lenconversions.inch)
1772 lenconversions[ [["]] ]=(lenconversions.inch)
1773 wait()
1774 lenconversions["feet"]=(lenconversions.foot)
1775 lenconversions["ft"]=(lenconversions.foot)
1776 lenconversions[ [[']] ]=(lenconversions.foot)
1777 wait()
1778 lenconversions["yards"]=(lenconversions.yard)
1779 lenconversions["yd"]=(lenconversions.yard)
1780 wait()
1781 lenconversions["miles"]=(lenconversions.mile)
1782 lenconversions["mi"]=(lenconversions.mile)
1783 wait()
1784 lenconversions["nautical mile"]=(lenconversions.nauticalmile)
1785 lenconversions["nm"]=(lenconversions.nauticalmile)
1786 lenconversions["nautical miles"]=(lenconversions.nauticalmile)
1787 lenconversions["nauticalmiles"]=(lenconversions.nauticalmile)
1788 wait()
1789 liqconversions["millilitres"]=(liqconversions.millilitre)
1790 liqconversions["milliliter"]=(liqconversions.millilitre)
1791 liqconversions["milliliters"]=(liqconversions.millilitre)
1792 liqconversions["ml"]=(liqconversions.millilitre)
1793 liquid["toMilliliters"]=(liquid.toMillilitres)
1794 wait()
1795 liqconversions["centilitres"]=(liqconversions.centilitre)
1796 liqconversions["centiliter"]=(liqconversions.centilitre)
1797 liqconversions["centiliters"]=(liqconversions.centilitre)
1798 liqconversions["cl"]=(liqconversions.centilitre)
1799 liquid["toCentiliters"]=(liquid.toCentilitres)
1800 wait()
1801 liqconversions["decilitres"]=(liqconversions.decilitre)
1802 liqconversions["deciliter"]=(liqconversions.decilitre)
1803 liqconversions["deciliters"]=(liqconversions.decilitre)
1804 liqconversions["dl"]=(liqconversions.decilitre)
1805 liquid["toDeciliters"]=(liquid.toDecilitres)
1806 wait()
1807 liqconversions["litres"]=(liqconversions.litre)
1808 liqconversions["liter"]=(liqconversions.litre)
1809 liqconversions["liters"]=(liqconversions.litre)
1810 liqconversions["l"]=(liqconversions.litre)
1811 liquid["toLiters"]=(liquid.toLitres)
1812 wait()
1813 liqconversions["kilolitres"]=(liqconversions.kilolitre)
1814 liqconversions["kiloliter"]=(liqconversions.kilolitre)
1815 liqconversions["kiloliters"]=(liqconversions.kilolitre)
1816 liqconversions["kl"]=(liqconversions.kilolitre)
1817 liquid["toKiloliters"]=(liquid.toKilolitres)
1818 wait()
1819 liqconversions["teaspoons"]=(liqconversions.teaspoon)
1820 liqconversions["tsp"]=(liqconversions.teaspoon)
1821 wait()
1822 liqconversions["tablespoons"]=(liqconversions.tablespoon)
1823 liqconversions["tbsp"]=(liqconversions.tablespoon)
1824 wait()
1825 liqconversions["cups"]=(liqconversions.cup)
1826 liqconversions["c"]=(liqconversions.cup)
1827 wait()
1828 liqconversions["pints"]=(liqconversions.pint)
1829 liqconversions["pt"]=(liqconversions.pint)
1830 wait()
1831 liqconversions["quarts"]=(liqconversions.quart)
1832 liqconversions["qt"]=(liqconversions.quart)
1833 wait()
1834 liqconversions["gallons"]=(liqconversions.gallon)
1835 liqconversions["gal"]=(liqconversions.gallon)
1836 wait()
1837 timeconversions["seconds"]=timeconversions.second
1838 timeconversions["sec"]=timeconversions.second
1839 timeconversions["secs"]=timeconversions.second
1840 timeconversions["s"]=timeconversions.second
1841 wait()
1842 timeconversions["minutes"]=timeconversions.minute
1843 timeconversions["min"]=timeconversions.minute
1844 timeconversions["mins"]=timeconversions.minute
1845 timeconversions["m"]=timeconversions.minute
1846 wait()
1847 timeconversions["hours"]=timeconversions.hour
1848 timeconversions["h"]=timeconversions.hour
1849 wait()
1850 timeconversions["weeks"]=timeconversions.week
1851 timeconversions["w"]=timeconversions.week
1852 wait()
1853 tempconversions["f"]=tempconversions.fahrenheit
1854 wait()
1855 tempconversions["k"]=tempconversions.kelvin
1856 wait()
1857 tempconversions["c"]=tempconversions.celsius
1858 end
1859 end,
1860
1861
1862 -- Conversion Functions
1863
1864 --[[
1865 HOW TO USE CONVERSION FUNCTIONS:
1866 (The way I'll do it will be the same as for any, just replacing "Millimetres" in "toMillimetres" to any measurement's proper plural. e.g: "toInches")
1867 toMilimetres("centimetre",20) -- Will return 200, since 20 centimetres is 200 millimetres -- The first parameter is the unit name, the second parameter is how much of that unit
1868 --]]
1869 length = {
1870 conversions = {["millimetre"]=1,["centimetre"]=10,["stud"]=200,["decimetre"]=100,["metre"]=1000,["kilometre"]=1000000,["inch"]=25.4,["foot"]=304.8,["yard"]=914.4,["mile"]=1.609e+6,["nauticalmile"]=1.852e+6,},
1871 toMillimetres = function(ctype,num)
1872 local result = nil
1873 CVExtra.conversion.addTo()
1874 local conversions = CVExtra.conversion.length.conversions
1875 if type(num)=="number" then
1876 if type(ctype)=="string" then
1877 local bey = conversions[ctype:lower()]
1878 if bey then
1879 local numb = bey
1880 local mm = num*numb
1881 result = mm
1882 end
1883 end
1884 end
1885 return result
1886 end,
1887
1888 toCentimetres = function(ctype,num)
1889 local result = nil
1890 CVExtra.conversion.addTo()
1891 local conversions = CVExtra.conversion.length.conversions
1892 if type(num)=="number" then
1893 if type(ctype)=="string" then
1894 local bey = conversions[ctype:lower()]
1895 if bey then
1896 local numb = bey
1897 local mm = num*numb
1898 result = mm/conversions["centimetre"]
1899 end
1900 end
1901 end
1902 return result
1903 end,
1904
1905 toDecimetres = function(ctype,num)
1906 local result = nil
1907 CVExtra.conversion.addTo()
1908 local conversions = CVExtra.conversion.length.conversions
1909 if type(num)=="number" then
1910 if type(ctype)=="string" then
1911 local bey = conversions[ctype:lower()]
1912 if bey then
1913 local numb = bey
1914 local mm = num*numb
1915 result = mm/conversions["decimetre"]
1916 end
1917 end
1918 end
1919 return result
1920 end,
1921
1922 toStuds = function(ctype,num)
1923 local result = nil
1924 CVExtra.conversion.addTo()
1925 local conversions = CVExtra.conversion.length.conversions
1926 if type(num)=="number" then
1927 if type(ctype)=="string" then
1928 local bey = conversions[ctype:lower()]
1929 if bey then
1930 local numb = bey
1931 local mm = num*numb
1932 result = mm/conversions["stud"]
1933 end
1934 end
1935 end
1936 return result
1937 end,
1938
1939 toMetres = function(ctype,num)
1940 local result = nil
1941 CVExtra.conversion.addTo()
1942 local conversions = CVExtra.conversion.length.conversions
1943 if type(num)=="number" then
1944 if type(ctype)=="string" then
1945 local bey = conversions[ctype:lower()]
1946 if bey then
1947 local numb = bey
1948 local mm = num*numb
1949 result = mm/conversions["metre"]
1950 end
1951 end
1952 end
1953 return result
1954 end,
1955
1956 toKilometres = function(ctype,num)
1957 local result = nil
1958 CVExtra.conversion.addTo()
1959 local conversions = CVExtra.conversion.length.conversions
1960 if type(num)=="number" then
1961 if type(ctype)=="string" then
1962 local bey = conversions[ctype:lower()]
1963 if bey then
1964 local numb = bey
1965 local mm = num*numb
1966 result = mm/conversions["kilometre"]
1967 end
1968 end
1969 end
1970 return result
1971 end,
1972
1973 toInches = function(ctype,num)
1974 local result = nil
1975 CVExtra.conversion.addTo()
1976 local conversions = CVExtra.conversion.length.conversions
1977 if type(num)=="number" then
1978 if type(ctype)=="string" then
1979 local bey = conversions[ctype:lower()]
1980 if bey then
1981 local numb = bey
1982 local mm = num*numb
1983 result = mm/conversions["inch"]
1984 end
1985 end
1986 end
1987 return result
1988 end,
1989
1990 toFeet = function(ctype,num)
1991 local result = nil
1992 CVExtra.conversion.addTo()
1993 local conversions = CVExtra.conversion.length.conversions
1994 if type(num)=="number" then
1995 if type(ctype)=="string" then
1996 local bey = conversions[ctype:lower()]
1997 if bey then
1998 local numb = bey
1999 local mm = num*numb
2000 result = mm/conversions["foot"]
2001 end
2002 end
2003 end
2004 return result
2005 end,
2006
2007 toYards = function(ctype,num)
2008 local result = nil
2009 CVExtra.conversion.addTo()
2010 local conversions = CVExtra.conversion.length.conversions
2011 if type(num)=="number" then
2012 if type(ctype)=="string" then
2013 local bey = conversions[ctype:lower()]
2014 if bey then
2015 local numb = bey
2016 local mm = num*numb
2017 result = mm/conversions["yard"]
2018 end
2019 end
2020 end
2021 return result
2022 end,
2023
2024 toMiles = function(ctype,num)
2025 local result = nil
2026 CVExtra.conversion.addTo()
2027 local conversions = CVExtra.conversion.length.conversions
2028 if type(num)=="number" then
2029 if type(ctype)=="string" then
2030 local bey = conversions[ctype:lower()]
2031 if bey then
2032 local numb = bey
2033 local mm = num*numb
2034 result = mm/conversions["mile"]
2035 end
2036 end
2037 end
2038 return result
2039 end,
2040 toNauticalMiles = function(ctype,num)
2041 local result = nil
2042 CVExtra.conversion.addTo()
2043 local conversions = CVExtra.conversion.length.conversions
2044 if type(num)=="number" then
2045 if type(ctype)=="string" then
2046 local bey = conversions[ctype:lower()]
2047 if bey then
2048 local numb = bey
2049 local mm = num*numb
2050 result = mm/conversions["nauticalmile"]
2051 end
2052 end
2053 end
2054 return result
2055 end,
2056 Convert = function(otype,ctype,num) -- Type to convert to, Type to convert, Number of units
2057 local result = nil
2058 CVExtra.conversion.addTo()
2059 local conversions = CVExtra.conversion.length.conversions
2060 if type(num)=="number" then
2061 if type(otype)=="string" and type(ctype)=="string" then
2062 local bey = conversions[ctype:lower()]
2063 local sey = conversions[otype:lower()]
2064 if bey and sey then
2065 local numb = bey
2066 local mm = num*numb
2067 result = mm/sey
2068 end
2069 end
2070 end
2071 return result
2072 end,
2073 },
2074 liquid = {
2075 conversions = {["millilitre"]=1,["centilitre"]=10,["decilitre"]=100,["litre"]=1000,["kilolitre"]=1000000,["teaspoon"]=4.2892,["tablespoon"]=14.7868,["cup"]=240,["pint"]=473.176,["quart"]=946.353,["gallon"]=3785.41},
2076 toMillilitres = function(ctype,num)
2077 local result = nil
2078 CVExtra.conversion.addTo()
2079 local conversions = CVExtra.conversion.liquid.conversions
2080 if type(num)=="number" then
2081 if type(ctype)=="string" then
2082 local bey = conversions[ctype:lower()]
2083 if bey then
2084 local numb = bey
2085 local ml = num*numb
2086 result = ml/conversions["millilitre"]
2087 end
2088 end
2089 end
2090 return result
2091 end,
2092 toCentilitres = function(ctype,num)
2093 local result = nil
2094 CVExtra.conversion.addTo()
2095 local conversions = CVExtra.conversion.liquid.conversions
2096 if type(num)=="number" then
2097 if type(ctype)=="string" then
2098 local bey = conversions[ctype:lower()]
2099 if bey then
2100 local numb = bey
2101 local ml = num*numb
2102 result = ml/conversions["centilitre"]
2103 end
2104 end
2105 end
2106 return result
2107 end,
2108 toDecilitres = function(ctype,num)
2109 local result = nil
2110 CVExtra.conversion.addTo()
2111 local conversions = CVExtra.conversion.liquid.conversions
2112 if type(num)=="number" then
2113 if type(ctype)=="string" then
2114 local bey = conversions[ctype:lower()]
2115 if bey then
2116 local numb = bey
2117 local ml = num*numb
2118 result = ml/conversions["decilitre"]
2119 end
2120 end
2121 end
2122 return result
2123 end,
2124 toLitres = function(ctype,num)
2125 local result = nil
2126 CVExtra.conversion.addTo()
2127 local conversions = CVExtra.conversion.liquid.conversions
2128 if type(num)=="number" then
2129 if type(ctype)=="string" then
2130 local bey = conversions[ctype:lower()]
2131 if bey then
2132 local numb = bey
2133 local ml = num*numb
2134 result = ml/conversions["litre"]
2135 end
2136 end
2137 end
2138 return result
2139 end,
2140 toKilolitres = function(ctype,num)
2141 local result = nil
2142 CVExtra.conversion.addTo()
2143 local conversions = CVExtra.conversion.liquid.conversions
2144 if type(num)=="number" then
2145 if type(ctype)=="string" then
2146 local bey = conversions[ctype:lower()]
2147 if bey then
2148 local numb = bey
2149 local ml = num*numb
2150 result = ml/conversions["kilolitre"]
2151 end
2152 end
2153 end
2154 return result
2155 end,
2156 Convert = function(otype,ctype,num) -- Type to convert to, Type to convert, Number of units
2157 local result = nil
2158 CVExtra.conversion.addTo()
2159 local conversions = CVExtra.conversion.liquid.conversions
2160 if type(num)=="number" then
2161 if type(otype)=="string" and type(ctype)=="string" then
2162 local bey = conversions[ctype:lower()]
2163 local sey = conversions[otype:lower()]
2164 if bey and sey then
2165 local numb = bey
2166 local ml = num*numb
2167 result = ml/sey
2168 end
2169 end
2170 end
2171 return result
2172 end,
2173 },
2174 time = {
2175 conversions={["second"]=1,["minute"]=60,["hour"]=3600,["day"]=86400,["week"]=604800},
2176 toSeconds = function(ctype,num)
2177 local result = nil
2178 CVExtra.conversion.addTo()
2179 local conversions = CVExtra.conversion.time.conversions
2180 if type(num)=="number" then
2181 if type(ctype)=="string" then
2182 local bey = conversions[ctype:lower()]
2183 if bey then
2184 local numb = bey
2185 local sec = num*numb
2186 result = sec/conversions["second"]
2187 end
2188 end
2189 end
2190 return result
2191 end,
2192 toMinutes = function(ctype,num)
2193 local result = nil
2194 CVExtra.conversion.addTo()
2195 local conversions = CVExtra.conversion.time.conversions
2196 if type(num)=="number" then
2197 if type(ctype)=="string" then
2198 local bey = conversions[ctype:lower()]
2199 if bey then
2200 local numb = bey
2201 local sec = num*numb
2202 result = sec/conversions["minute"]
2203 end
2204 end
2205 end
2206 return result
2207 end,
2208 toHours = function(ctype,num)
2209 local result = nil
2210 CVExtra.conversion.addTo()
2211 local conversions = CVExtra.conversion.time.conversions
2212 if type(num)=="number" then
2213 if type(ctype)=="string" then
2214 local bey = conversions[ctype:lower()]
2215 if bey then
2216 local numb = bey
2217 local sec = num*numb
2218 result = sec/conversions["hour"]
2219 end
2220 end
2221 end
2222 return result
2223 end,
2224 toDays = function(ctype,num)
2225 local result = nil
2226 CVExtra.conversion.addTo()
2227 local conversions = CVExtra.conversion.time.conversions
2228 if type(num)=="number" then
2229 if type(ctype)=="string" then
2230 local bey = conversions[ctype:lower()]
2231 if bey then
2232 local numb = bey
2233 local sec = num*numb
2234 result = sec/conversions["day"]
2235 end
2236 end
2237 end
2238 return result
2239 end,
2240 toWeeks = function(ctype,num)
2241 local result = nil
2242 CVExtra.conversion.addTo()
2243 local conversions = CVExtra.conversion.time.conversions
2244 if type(num)=="number" then
2245 if type(ctype)=="string" then
2246 local bey = conversions[ctype:lower()]
2247 if bey then
2248 local numb = bey
2249 local sec = num*numb
2250 result = sec/conversions["week"]
2251 end
2252 end
2253 end
2254 return result
2255 end,
2256 Convert = function(otype,ctype,num) -- Type to convert to, Type to convert, Number of units
2257 local result = nil
2258 CVExtra.conversion.addTo()
2259 local conversions = CVExtra.conversion.time.conversions
2260 if type(num)=="number" then
2261 if type(otype)=="string" and type(ctype)=="string" then
2262 local bey = conversions[ctype:lower()]
2263 local sey = conversions[otype:lower()]
2264 if bey and sey then
2265 local numb = bey
2266 local sec = num*numb
2267 result = sec/sey
2268 end
2269 end
2270 end
2271 return result
2272 end,
2273 },
2274 temp = {
2275 conversions = {["fahrenheit"]=1,["celsius"]=9/5+32,["kelvin"]=-273.15*9/5+32,},
2276 toFahrenheit = function(ctype,num)
2277 local result = nil
2278 CVExtra.conversion.addTo()
2279 local conversions = CVExtra.conversion.temp.conversions
2280 if type(num)=="number" then
2281 if type(ctype)=="string" then
2282 local bey = conversions[ctype:lower()]
2283 if bey then
2284 local numb = bey
2285 local f
2286 if numb==1 then
2287 f=num
2288 elseif numb==33.8 then
2289 local convertf=num*9/5+32
2290 f=convertf
2291 elseif numb==(-273.15*9/5+32) then
2292 local convertf=num-273.15*9/5+32
2293 f=convertf
2294 end
2295 result = f
2296 end
2297 end
2298 end
2299 return result
2300 end,
2301 toCelsius = function(ctype,num)
2302 local result = nil
2303 CVExtra.conversion.addTo()
2304 local conversions = CVExtra.conversion.temp.conversions
2305 if type(num)=="number" then
2306 if type(ctype)=="string" then
2307 local bey = conversions[ctype:lower()]
2308 if bey then
2309 local numb = bey
2310 local f
2311 if numb==1 then
2312 local convertf=num-32*5/9
2313 f=convertf
2314 elseif numb==33.8 then
2315 f=num
2316 elseif numb==(-273.15*9/5+32) then
2317 local convertf=num-273.15
2318 f=convertf
2319 end
2320 result = f
2321 end
2322 end
2323 end
2324 return result
2325 end,
2326 toKelvin = function(ctype,num)
2327 local result = nil
2328 CVExtra.conversion.addTo()
2329 local conversions = CVExtra.conversion.temp.conversions
2330 if type(num)=="number" then
2331 if type(ctype)=="string" then
2332 local bey = conversions[ctype:lower()]
2333 if bey then
2334 local numb = bey
2335 local f
2336 if numb==1 then
2337 local convertf=num-32*5/9+273.15
2338 f=convertf
2339 elseif numb==33.8 then
2340 local convertf=num+273.15
2341 f=convertf
2342 elseif numb==(-273.15*9/5+32) then
2343 f=num
2344 end
2345 result = f
2346 end
2347 end
2348 end
2349 return result
2350 end,
2351 Convert = function(otype,ctype,num) -- Type to convert to, Type to convert, Number of units
2352 local result = nil
2353 CVExtra.conversion.addTo()
2354 local toF = CVExtra.conversion.temp.toFahrenheit
2355 local toK = CVExtra.conversion.temp.toKelvin
2356 local toC = CVExtra.conversion.temp.toCelsius
2357 local conversions = CVExtra.conversion.temp.conversions
2358 if type(num)=="number" then
2359 if type(otype)=="string" and type(ctype)=="string" then
2360 local bey = conversions[ctype:lower()]
2361 local sey = conversions[otype:lower()]
2362 if bey and sey then
2363 if sey==1 then
2364 result=toF(ctype,num)
2365 elseif sey==33.8 then
2366 result=toC(ctype,num)
2367 elseif sey==(-273.15*9/5+32) then
2368 result=toK(ctype,num)
2369 end
2370 end
2371 end
2372 end
2373 return result
2374 end,
2375 },
2376 },
2377 checkLegitimateMatch = function(s,match,caseinsensitive)
2378 local result = nil
2379
2380 -- REQUIRED FUNCTIONS
2381 local toChar = CVExtra.toCharList
2382 local getChar = CVExtra.getChar
2383 --
2384
2385 local function getmatch(str)
2386 local gmresult
2387 local nm = match -- newMatch
2388 local nstr=str
2389 if caseinsensitive == true then
2390 nstr = str:lower()
2391 nm=nm:lower()
2392 end
2393 local dm = toChar(nm) -- doMatch
2394 local check = true
2395 for i,v in pairs(dm) do
2396 if v==getChar(nstr,i) then
2397 else
2398 check = false
2399 break
2400 end
2401 end
2402 if check==true then
2403 gmresult = str
2404 end
2405 return gmresult
2406 end
2407 local rtable = {}
2408 if type(match)=="string" then
2409 if type(s)=="string" then
2410 result = getmatch(s)
2411 elseif type(s)=="table" then
2412 for i,v in pairs(s) do
2413 if type(v)=="string" then
2414 local havematch = getmatch(v)
2415 if havematch~=nil then
2416 table.insert(rtable,havematch)
2417 end
2418 end
2419 end
2420 result = rtable
2421 else
2422 result=nil
2423 end
2424 end
2425 return result
2426 end,
2427 GetPlayersFromString = function(s,caseinsensitive)
2428 local result = nil
2429 local name
2430 local playerlist = {}
2431 local players = game.Players
2432
2433 -- REQUIRED FUNCTIONS
2434 local toChar = CVExtra.toCharList
2435 local getChar = CVExtra.getChar
2436 --
2437
2438 local function getPlayers(name)
2439 if caseinsensitive==true then
2440 name = name:lower()
2441 end
2442 for i,plr in pairs(players:GetPlayers()) do
2443 local pname = plr.Name
2444 if caseinsensitive==true then
2445 pname = pname:lower()
2446
2447 end
2448 local nChar = toChar(name)
2449 local check = true
2450 for i,v in pairs(nChar) do
2451 if v==getChar(pname,i) then
2452 else
2453 check = false
2454 break
2455 end
2456 end
2457 if check==true then
2458 table.insert(playerlist,plr)
2459 end
2460 end
2461 end
2462 if type(s) == "string" then
2463 name = s
2464 getPlayers(name)
2465 elseif typeof(s)=="Instance" then
2466 name = s.Name
2467 getPlayers(name)
2468 end
2469 result = playerlist
2470 return result
2471 end,
2472 removeLetter = function(s,it)
2473 local result = nil
2474
2475 -- REQUIRED FUNCTIONS
2476 local toChar = CVExtra.toCharList
2477 local getChar = CVExtra.getChar
2478 local toString = CVExtra.charlistToString
2479 --
2480
2481 local function remove(ltrs)
2482 ltrs[it]=nil
2483 end
2484 if type(s)=="string" then
2485 local letters = toChar(s)
2486 if type(it)=="number" then
2487 if #letters>=it then
2488 remove(letters)
2489 end
2490 end
2491 local ns = toString(letters)
2492 result = ns
2493 end
2494 return result
2495 end,
2496 addLetter = function(s,addl,it)
2497 local result = nil
2498
2499 -- REQUIRED FUNCTIONS
2500 local toChar = CVExtra.toCharList
2501 local getChar = CVExtra.getChar
2502 local toString = CVExtra.charlistToString
2503 --
2504
2505 local function add(ltrs)
2506 table.insert(ltrs,it,addl)
2507 end
2508 if type(s)=="string" and type(addl)=="string" then
2509 local letters = toChar(s)
2510 if type(it)=="number" then
2511 add(letters)
2512 end
2513 local ns = toString(letters)
2514 result = ns
2515 end
2516 return result
2517 end,
2518 replaceLetter = function(s,rpll,it) -- WIP
2519 local result = nil
2520
2521 -- REQUIRED FUNCTIONS
2522 local toChar = CVExtra.toCharList
2523 local getChar = CVExtra.getChar
2524 local toString = CVExtra.charlistToString
2525 --
2526
2527 local function replace(ltrs)
2528 local rpllchar = toChar(rpll)
2529 local i=it
2530 repeat
2531 ltrs[i]=nil
2532 i=i+1
2533 until ltrs[i]==nil or i>=#rpllchar
2534 local oi = i
2535 i=1
2536 repeat
2537 ltrs[it+i]=rpllchar[i]
2538 rpllchar[i]=nil
2539 i=i+1
2540 until i>oi
2541 if #rpllchar>0 then
2542 oi = #rpllchar
2543 i=1
2544 repeat
2545 table.insert(ltrs,rpllchar[i])
2546 rpllchar[i]=nil
2547 i=i+1
2548 until i>=oi
2549 end
2550 end
2551 if type(s)=="string" and type(rpll)=="string" then
2552 local letters = toChar(s)
2553 if it==nil then
2554 it=0
2555 end
2556 if type(it)=="number" then
2557 replace(letters)
2558 end
2559 local ns = toString(letters)
2560 result = ns
2561 end
2562 return result
2563 end,
2564 photomanipulation = {
2565 blacknwhite = function(rgb)
2566 local result = nil
2567
2568 -- REQUIRED FUNCTIONS
2569 local desat = CVExtra.colours.desaturate
2570 --
2571
2572 result = desat(rgb,100)
2573 return result
2574 end,
2575 sepia = function(rgb)
2576 local result = nil
2577 if typeof(rgb)=="Color3" then
2578 local HSVt = {0,0,0}
2579 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
2580 HSVt[1] = 30/359
2581 if HSVt[2]<10/255 then
2582 HSVt[2]=HSVt[2]+(10/255)
2583 end
2584 if HSVt[2]>230/255 then
2585 HSVt[2]=230/255
2586 end
2587 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
2588 result = HSV
2589 end
2590 return result
2591 end,
2592 cyanotype = function(rgb)
2593 local result = nil
2594 if typeof(rgb)=="Color3" then
2595 local HSVt = {0,0,0}
2596 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
2597 HSVt[1] = 195/359
2598 if HSVt[2]<25/255 then
2599 HSVt[2]=HSVt[2]+(25/255)
2600 end
2601 if HSVt[2]>250/255 then
2602 HSVt[2]=250/255
2603 end
2604 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
2605 result = HSV
2606 end
2607 return result
2608 end,
2609 customtonetowhite = function(rgb,rgbpicked)
2610 local result = nil
2611 if typeof(rgb)=="Color3" then
2612 local HSVt = {0,0,0}
2613 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
2614 local HSVt2 = {0,0,0}
2615 HSVt2[1],HSVt2[2],HSVt2[3]=Color3.toHSV(rgbpicked)
2616 HSVt[1]=HSVt2[1]
2617 if HSVt[3]<HSVt2[3] then
2618 HSVt[3]=HSVt2[3]
2619 HSVt[2]=HSVt2[2]
2620 end
2621 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
2622 result = HSV
2623 end
2624 return result
2625 end,
2626 photomlist =
2627 {"blacknwhite","bw","blackandwhite","black&white",
2628 "sepia",
2629 "cyanotype",
2630 "ctmwhite","customtowhite","customwhite","customtonetowhite",},
2631
2632 world = function(s,carg1)
2633 local photomlist = CVExtra.photomanipulation.photomlist
2634 local function match()
2635 local result = nil
2636 for i,v in pairs(photomlist) do
2637 if s:lower()==v then
2638 if i>0 and i<=4 then
2639 result = 1
2640 break
2641 elseif i==5 then
2642 result = 2
2643 break
2644 elseif i==6 then
2645 result = 3
2646 break
2647 elseif i>6 and i<=10 then
2648 result = 4
2649 break
2650 end
2651 end
2652 end
2653 return result
2654 end
2655 local function doworld(md)
2656 local places = {game.Workspace,game.StarterGui,game.StarterPack,game.Players}
2657 local Type = nil
2658 local GetAll = CVExtra.GetAllChildren
2659 if md==1 then
2660 Type="blacknwhite"
2661 elseif md==2 then
2662 Type="sepia"
2663 elseif md==3 then
2664 Type="cyanotype"
2665 elseif md==4 then
2666 Type="customtonetowhite"
2667 if typeof(carg1)=="Color3" then
2668 else
2669 warn("CVExtra.photomanipulation.vision: A colour must be specified for: customtonetowhite -- Setting to black&white")
2670 Type="blacknwhite"
2671 end
2672 end
2673 local colour = CVExtra.photomanipulation[Type]
2674 local function changeColour(rgb)
2675 local result
2676 if Type=="customtonetowhite" then
2677 local rgb2 = carg1
2678 local ncolour = colour(rgb,rgb2)
2679 local nHSV = {0,0,0}
2680 nHSV[1],nHSV[2],nHSV[3]=Color3.toHSV(ncolour)
2681 if nHSV[2]<20/255 then
2682 nHSV[2]=20/255
2683 end
2684 ncolour = Color3.fromHSV(nHSV[1],nHSV[2],nHSV[3])
2685 result = ncolour
2686 else
2687 result = colour(rgb)
2688 end
2689 return result
2690 end
2691 for i,place in pairs(places) do
2692 local placestuff = GetAll(place,true)
2693 for a,stuff in pairs(placestuff) do
2694 if stuff:IsA("BasePart") or stuff:IsA("Light") then
2695 stuff.Color = changeColour(stuff.Color)
2696 elseif stuff:IsA("GuiObject") then
2697 stuff.BackgroundColor3 = changeColour(stuff.BackgroundColor3)
2698 stuff.BorderColor3 = changeColour(stuff.BorderColor3)
2699 if stuff:IsA("TextBox") or stuff:IsA("TextLabel") or stuff:IsA("TextButton") then
2700 stuff.TextColor3 = changeColour(stuff.TextColor3)
2701 stuff.TextStrokeColor3 = changeColour(stuff.TextStrokeColor3)
2702 elseif stuff:IsA("ImageLabel") or stuff:IsA("ImageButton") then
2703 stuff.ImageColor3 = changeColour(stuff.ImageColor3)
2704 elseif stuff:IsA("BodyColors") then
2705 stuff.HeadColor3 = changeColour(stuff.HeadColor3)
2706 stuff.TorsoColor3 = changeColour(stuff.TorsoColor3)
2707 stuff.LeftArmColor3 = changeColour(stuff.LeftArmColor3)
2708 stuff.RightArmColor3 = changeColour(stuff.RightArmColor3)
2709 stuff.LeftLegColor3 = changeColour(stuff.LeftLegColor3)
2710 stuff.RightLegColor3 = changeColour(stuff.RightLegColor3)
2711 end
2712 else
2713 end
2714 end
2715 wait()
2716 end
2717 end
2718 if type(s)=="string" then
2719 local matched = match(s)
2720 if matched==nil then
2721
2722 else
2723 doworld(matched)
2724 end
2725 end
2726 end,
2727 vision = function(s,carg1)
2728 local photomlist = CVExtra.photomanipulation.photomlist
2729 local function match()
2730 local result = nil
2731 for i,v in pairs(photomlist) do
2732 if s:lower()==v then
2733 if i>0 and i<=4 then
2734 result = 1
2735 break
2736 elseif i==5 then
2737 result = 2
2738 break
2739 elseif i==6 then
2740 result = 3
2741 break
2742 elseif i>6 and i<=10 then
2743 result = 4
2744 break
2745 end
2746 end
2747 end
2748 return result
2749 end
2750 local function dovision(md)
2751 local Type = nil
2752 local affirmcarg1 = false
2753 local Lighting = game:GetService("Lighting")
2754 if md==1 then
2755 Type="blacknwhite"
2756 elseif md==2 then
2757 Type="sepia"
2758 elseif md==3 then
2759 Type="cyanotype"
2760 elseif md==4 then
2761 Type="customtonetowhite"
2762 if typeof(carg1)=="Color3" then
2763 affirmcarg1=true
2764 else
2765 warn("CVExtra.photomanipulation.vision: A colour must be specified for: customtonetowhite -- Setting to black&white")
2766 Type="blacknwhite"
2767 end
2768 end
2769 local colourfunc = CVExtra.photomanipulation[Type]
2770 local function color(rgb)
2771 local colorc
2772 local light = Lighting:GetChildren()
2773 for i,v in pairs(light) do
2774 if v.Name=="Vision" then
2775 v.Parent=nil
2776 end
2777 end
2778 colorc = Instance.new("ColorCorrectionEffect")
2779 colorc.Name = "Vision"
2780 colorc.Saturation = -1
2781 colorc.TintColor = rgb
2782 return colorc
2783 end
2784 local basecolour = Color3.fromRGB(255,100,100)
2785 local colour
2786 if Type=="customtonetowhite" then
2787 basecolour = carg1
2788 colour = colourfunc(basecolour,carg1)
2789 else
2790 colour = colourfunc(basecolour)
2791 end
2792 local coloreffect = color(colour)
2793 coloreffect.Parent = Lighting
2794 end
2795 local mode = match()
2796 dovision(mode)
2797 end,
2798 },
2799 dropHats = function(plr)
2800 local result
2801 local hats = {}
2802
2803 -- REQUIRED FUNCTIONS
2804 local getPlayer = CVExtra.getPlayer
2805 --
2806
2807 local function drophats()
2808 local char
2809 if plr:IsA("Player") then
2810 char = plr.Character
2811 elseif plr:IsA("Model") then
2812 char = plr
2813 end
2814 for i,hat in pairs(char:GetChildren()) do
2815 if hat:IsA("Accessory") or hat:IsA("Hat") then
2816 table.insert(hats,hat)
2817 hat.Parent = workspace
2818 end
2819 end
2820 result = hats
2821 end
2822 if type(plr)=="string" then
2823 local newplr = getPlayer(plr)
2824 if newplr == nil then
2825
2826 else
2827 plr = newplr
2828 drophats()
2829 end
2830 elseif typeof(plr)=="Instance" then
2831 if plr:IsA("Model") or plr:IsA("Player") then
2832 drophats()
2833 end
2834 end
2835 return hats
2836 end,
2837 getVector3Area = function(object,range,shape) -- WIP
2838 local reg3
2839 local objvec
2840 local vecmin
2841 local vecmax
2842 local ago = true
2843 if typeof(object)=="Instance" then
2844 if object:IsA("BasePart") then
2845 objvec = object.Position
2846 vecmin = Vector3.new(objvec.X-object.Size.X,objvec.Y-object.Size.Y,objvec.Z-object.Size.Z)
2847 vecmax = Vector3.new(objvec.X+object.Size.X,objvec.Y+object.Size.Y,objvec.Z+object.Size.Z)
2848 elseif typeof(object)=="Vector3" then
2849 objvec = object
2850 vecmin = objvec
2851 vecmax = objvec
2852 else
2853 ago = false
2854 end
2855 else
2856 ago = false
2857 end
2858 print(objvec)
2859 if type(range)=="number" then
2860 range = range/2
2861 else
2862 ago = false
2863 end
2864 shape="cube"
2865 if ago==true then
2866 local ranvec = Vector3.new(range,range,range)
2867 local vecmin2=Vector3.new(vecmin.X-ranvec.X,vecmin.Y-ranvec.Y,vecmin.Z-ranvec.Z)
2868 local vecmax2=Vector3.new(vecmax.X+ranvec.X,vecmax.Y-ranvec.Y,vecmax.Z-ranvec.Z)
2869 print(objvec)
2870 print(ranvec)
2871 print(vecmin2)
2872 print(vecmax2)
2873 reg3 = Region3.new(vecmin2,vecmax2)
2874 end
2875 return reg3
2876 end,
2877 getAncestry = function(instance)
2878 local result
2879 local ancestry = {}
2880 local lastpar
2881 if typeof(instance)=="Instance" then
2882 lastpar=instance.Parent
2883 while (lastpar.Parent) do
2884 table.insert(ancestry,lastpar)
2885 lastpar=lastpar.Parent
2886 end
2887 for i=1,math.floor(#ancestry/2) do
2888 local j = #ancestry - i + 1
2889 ancestry[i], ancestry[j] = ancestry[j], ancestry[i]
2890 end
2891 result=ancestry
2892 end
2893 return result
2894 end,
2895 getCommands = function()
2896 local result
2897 local functions
2898 functions = {}
2899 local function searchTable(tab,nam,prevp)
2900 local i = 1
2901 if prevp==nil then
2902 else
2903 nam = prevp..nam
2904 end
2905 prevp=nam.."."
2906 for d,v in pairs(tab) do
2907 if type(v)=="table" then
2908 searchTable(v,tostring(d),prevp)
2909 elseif typeof(v)=="function" then
2910 functions[i]=nam..".".. tostring(d)
2911 i=#functions+1
2912 else
2913 end
2914 end
2915 end
2916 searchTable(CVExtra,"CVExtra")
2917 if #functions>1 then
2918 result = functions
2919 end
2920 return result
2921 end,
2922 limitedTable = function(len,name) -- Inspiration from debates in: https://forum.scriptinghelpers.org/topic/734/what-would-you-guys-want-to-see-in-a-modulescript
2923 local result
2924 len = tonumber(len)
2925 local t = {}
2926 local tablename
2927
2928 -- REQUIRED FUNCTIONS
2929 local mathrandom = CVExtra.mathrandom
2930 --
2931
2932 local metatable = {}
2933 if type(name)=="string" then
2934 tablename = name
2935 else
2936 tablename = tostring(metatable)
2937 end
2938 if len~=nil then
2939 if len<0 then
2940 len=0
2941 end
2942 metatable = {
2943 lengthmax = len,
2944 __newindex = function(self,iter,val)
2945 if val==nil then
2946 else
2947 if (#self+1>len) then
2948 rawset(self, iter, nil)
2949 warn(tablename..": cannot add in another element -- max "..len);
2950 else
2951 rawset(self,iter,val)
2952 end
2953 end
2954 end,
2955 spawn(function()
2956 local self = t
2957 local db = false
2958 repeat
2959 if #self>len then
2960 if db==false then
2961 db = true
2962 warn(tablename..": ".."cannot have more than "..len.." element(s) in a table!")
2963 for i,v in pairs(self) do
2964 if i>len then
2965 self[i]=nil
2966 end
2967 end
2968 if len<1 then
2969 self[1]=nil
2970 end
2971 db=false
2972 end
2973 end
2974 wait(mathrandom(0.1,0.9))
2975 until 1==0
2976 end),
2977 getLength = function()
2978 local self = t
2979 local length = self.lengthmax
2980 return length
2981 end,
2982 }
2983
2984 t = setmetatable(t,metatable)
2985 result = t
2986 end
2987 return result
2988 end,
2989 WaitForChildOfClass = function(par,nam,timeout)
2990 -- Why doesn't a "WaitForChildOfClass" exist if "WaitForChild" and "FindFirstChildOfClass" exist?
2991 local result
2992 local boolDo=true -- Set to false if par or nam is invalid
2993 if typeof(timeout)~="number" then
2994 timeout=5
2995 elseif typeof(timeout)=="number" then
2996 if timeout<0 then
2997 timeout=0.5
2998 end
2999 end
3000 if typeof(nam)=="Instance" then
3001 nam=nam.ClassName
3002 elseif typeof(nam)~="string" then
3003 boolDo=false
3004 end
3005 if typeof(par)=="Instance" then
3006 else
3007 boolDo=false
3008 end
3009 if boolDo==true then
3010 local instanceTest=pcall(function() Instance.new(nam) end)
3011 boolDo=instanceTest
3012 end
3013 if boolDo==true then
3014 local parC=par:GetChildren()
3015 for i=0,timeout,0.05 do
3016 for e,v in pairs(parC) do
3017 if v:IsA(nam) then
3018 result=v
3019 break
3020 else
3021 end
3022 end
3023 if result~=nil then
3024 break
3025 end
3026 parC=par:GetChildren()
3027 wait()
3028 end
3029 end
3030 return result
3031 end,
3032 tablereverse=function(t) -- Provided by: buildthomas -- Check: https://devforum.roblox.com/t/how-would-i-reverse-a-table/152785
3033 -- (Was too lazy to make my own anyways and this one works too well to just throw away)
3034 local result
3035 if type(t)=="table" then
3036 for i=1,math.floor(#t/2) do
3037 local j = #t - i + 1
3038 t[i], t[j] = t[j], t[i]
3039 end
3040 end
3041 return result
3042 end,
3043 tableclone=function(t) -- WIP
3044 local result
3045 local nt={}
3046 local function clonetable(par,tab,i)
3047 local newtab={}
3048 for x,v in pairs(tab) do
3049 if type(v)=="number" or type(v)=="integer" then
3050 newtab[tostring(tab[x])]=tonumber(v)
3051 elseif type(v)=="string" then
3052 newtab[tostring(tab[x])]=tostring(v)
3053 elseif type(v)=="table" then
3054 clonetable(tab,v,tostring(x))
3055 else
3056 newtab[tostring(tab[x])]=v
3057 end
3058 end
3059 if par~=nil then
3060 if i==nil then
3061 par[#par+1]=tab
3062 else
3063 par[i]=tab
3064 end
3065 else
3066 end
3067 return tab
3068 end
3069 if type(t)=="table" then
3070 nt=clonetable(nil,t)
3071 result=nt
3072 end
3073 return result
3074 end,
3075 GetMass=function(model)
3076 local result
3077 local function GetMass(instance)
3078 local mass=0
3079 if instance:IsA("BasePart") then
3080 mass=instance:GetMass()
3081 end
3082 for i,v in pairs(instance:GetDescendants()) do
3083 if v:IsA("BasePart") then
3084 mass=mass+v:GetMass()
3085 end
3086 end
3087 return mass
3088 end
3089 if typeof(model)=="Instance" then
3090 local tmass
3091 tmass=GetMass(model)
3092 result=tmass
3093 end
3094 return result
3095 end,
3096}
3097return CVExtra