· 7 years ago · Jan 06, 2019, 07:36 AM
1-- Created and produced by Cvieyra2test
2
3-- Code, Tips & Functions are pass the "License"
4
5
6--[[
7 L I C E N S E
8https://choosealicense.com/licenses/mit/
9
10 Copyright (c) 2018-2019 Christian V/Cvieyra2test/cvieyra
11
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in all
20 copies or substantial portions of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 SOFTWARE.
29
30 -->> Additional <<--
31 It is recommended, but not forced, to have altered code open-source. As to help others educate and familiarize
32 themselves in a coding environment. Holders of code may keep their altered code closed or may sell it, but
33 may not lay claim to the original document by Cvieyra2test/cvieyra/Christian V and cannot authorize a copyright
34 strike against them if similar code is found in updated documents as well as can't lay copyright strikes against
35 the Roblox Corporation. Check 6B, part 3 of document: https://en.help.roblox.com/hc/en-us/articles/115004647846-Roblox-Terms-of-Use
36 for further information on Roblox's rights to the property.
37
38 This module script is intended to help others in coding and developing their games.
39
40--]]
41
42
43---------------------------- USAGE: ----------------------------
44
45-- This following tutorial assumes you put CVExtra in workspace, if you put it in any other game-based container,
46-- simply change "workspace" to game.nameOfTheContainer.CVExtra
47
48--[[
49 I M P O R T A N T
50
51--> There also appears to be an issue with localscripts requiring the module script. Simply find the function you want from the module script, select & copy it, then paste it into your local script in the beginning of your local script.
52
53
54--]]
55--[[
56 T U T O R I A L
57
58 HOW TO GET A SCRIPT TO USE IT:
59 Do this on the global scope of a script (not inside a function or "if" or loop statement):
60 CVExtra = require(workspace.CVExtra)
61 To do a function inside CV Extra, you'd do:
62 CVExtra.capitalize("louis") to get "Louis"
63 You can locally define CVExtra functions like this:
64 numbify = CVExtra.numbify (for a global scale) OR local numbify = CVExtra.numbify (for inside a function or etc)
65 Although there is functions that are stored in a table within CVEXtra, in this case we'd do:
66 CVExtra.Math -- to get it, and to get functions in it, we'd do: CVExtra.Math.square
67
68--]]
69----------------------------------------------------------------------------------------------------------
70--[[
71 T I P S
72
73 Deletion: instance.Parent = nil (or) instance:Destroy()
74
75 Infinity: math.huge()
76
77 Getting A List of Players: game.Players:GetPlayers() (or) game:GetService("Players"):GetPlayers()
78
79 Getting the model of a player: game.Players.(Player).Character
80
81 Getting power of number: num^num (Instead of using "math.square" or "math.cube")
82
83 Part:FindFirstChild("instance",true) will attempt to find a part named "instance" within all children of "Part" (Entirety of descendants)
84
85 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.
86
87 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)
88
89
90
91 F U N C T I O N S
92
93 numbify(string) -- Gets numbers & decimal point from a provided string
94 EXAMPLE USAGE: numbify("It is 30.5 degrees celsius outside!!!")
95 RETURNS: 30.5
96
97Math -- CVExtra.Math (PREFIX functions with Math.)
98
99 >>round(number) -- Rounds a number depending on its tenth digit (0.1)
100 EXAMPLE USAGE: round(3.5)
101 RETURNS: 4
102
103 >>square(number) -- Squares a number -- a number to the power of 2 (num^2)
104 EXAMPLE USAGE: square(5)
105 RETURNS: 25
106
107 >>cube(number) -- Cubes a number -- a number to the power of 3 (num^3)
108 EXAMPLE USAGE: cube(3)
109 RETURNS: 9
110
111 >>area(number,number) -- Creates an area (squared space) from two numbers
112 EXAMPLE USAGE: area(3,7)
113 RETURNS: 21
114
115 >>volume(number,number,number) -- Creates a volume (cubed space) from three numbers
116 EXAMPLE USAGE: volume(3,8,2)
117 RETURNS: 48
118
119 >>inverse(number) -- Creates the opposite of a number -- inverse
120 EXAMPLE USAGE: inverse(3)
121 RETURNS: -3
122
123<<-- Math ------------------
124
125 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
126 EXAMPLE USAGE: randomPercentage(25)
127 RETURNS: true (or) false (depending if it equals to or is lower than randomized number)
128
129 percent(number,number,bool round) -- Gets percentage from two numbers, the bool determines whether or not it rounds the percentage
130 EXAMPLE USAGE: percent(8,10)
131 RETURNS: 80
132 IF BOOL
133 EXAMPLE USAGE: percent(7,11,true)
134 RETURNS: 0.6
135
136 capitalize(string) -- Capitalizes the first letter of any string
137 EXAMPLE USAGE: "louis is a goodman"
138 RETURNS: "Louis is a goodman"
139
140 printIndent(number indents) -- Intended to be used in the script output, otherwise pointless to use
141 EXAMPLE USAGE: printIndent(3)
142 RETURNS: (3 indents in the output)
143
144 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
145 EXAMPLE USAGE: playAudio(sound)
146 Plays audio, updates startTime & endTime in conjunction with updates in playbackSpeed of Audio
147 (or)
148 EXAMPLE USAGE: playAudio(sound,1.2)
149 Plays audio, setting its playbackSpeed to "1.2"
150 (or)
151 EXAMPLE USAGE: playAudio(sound,1,5)
152 Plays audio at startTime "5" (5 seconds into audio) -- With the sound's playbackSpeed set to "1"
153 (or)
154 EXAMPLE USAGE: playAudio(sound,1,0,3)
155 Plays audio at StartTime "0" -- With playbackSpeed set to "1" -- Ending at "3" (3 seconds into Audio)
156
157 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
158 EXAMPLE USAGE: getPlayer("Cvieyra2test")
159 RETURNS: (If it finds it) game.Players.Cvieyra2test
160
161 createleaderStats(instance player/string name) -- Adds a "leaderstats" to the select player -- Can use a string to find the player -- Returns the leaderstats
162 EXAMPLE USAGE: createleaderStats(player) -- Assuming "player" is defined as a player
163 RETURNS: leaderstats
164
165 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
166 EXAMPLE USAGE: clean(workspace,"model",true)
167 Checks through workspace for "model" 's that have no children, then deletes them, at a quick, mere instantaniously pace
168
169 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
170 EXAMPLE USAGE: cleanHats(true)
171 Quickly deletes all hats in the workspace
172
173 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
174 EXAMPLE USAGE: areaOf(workspace.Part) -- With measurements: 2,3,2
175 RETURNS: 4
176
177 volumeOf(instance BasePart) -- Gets a "volume" of a part from tis X, Y & Z -- Does not accurately calculate by shape
178 EXAMPLE USAGE: volumeOf(workspace.Part) -- With measurements 2,3,2
179 RETURNS: 12
180
181colours -- CVExtra.colours (PREFIX functions with colours.)
182
183 >>list.(somecolour) -- A list of prepicked colours -- How to get "highlighter" from list: colours.highlighter (or) colours.getColour("highlighter")
184
185 >>addColour(string name,color3 rgb) -- Adds a custom colour with the specified RGB code, named the provided string to colours.list
186 EXAMPLE USAGE: addColour("pyrite2",Color3.fromRGB(138,125,94)) -- "Color.fromRGB(138,125,94)" can be replaced with a RGB variable
187 RETURNS: list["pyrite2"]
188
189 >>getColour(string name) -- Gets a colour from list
190 EXAMPLE USAGE: getColour("caramel")
191 RETURNS: list["caramel"] -- RGB: 185,93,1
192
193 >>darken(color3 rgb,number amount) -- Darkens a color3 by a percentage amount (number from 1-100)
194 EXAMPLE USAGE: darken(Color3.fromRGB(240,210,100),10)
195 RETURNS: 0.841177, 0.736029, 0.35049 (Color3)
196
197 >>lighten(color3 rgb,number amount) -- Brightens a color3 by a percentage amount (number from 1-100)
198 EXAMPLE USAGE: lighten(Color3.fromRGB(120,40,60),10)
199 RETURNS: 0.570588, 0.190196, 0.285294 (Color3)
200
201 >>desaturate(color3 rgb,number amount) -- Desaturates a color3 by a percentage amount (number from 1-100)
202 EXAMPLE USAGE: desaturate: desaturate(Color3.fromRGB(200,100,20),10)
203 RETURNS: 0.884314, 0.442157, 0.0884314 (Color3)
204
205 >>saturate(color3 rgb,number amount) -- Saturates a color3 by a percentage amount (number from 1-100)
206 EXAMPLE USAGE: saturate(Color3.fromRGB(120,102,130),10)
207 RETURNS: 0.562896, 0.478462, 0.609804 (Color3)
208
209 >>colourFromHex(color3 hex) -- Gets a Color3 from a Hex Colour
210 EXAMPLE USAGE: colourFromHex(0x42d1f4)
211 RETURNS: 0.258824, 0.819608, 0.956863 (Color3)
212
213 >>colourFromVector3(vector3 v3) -- Gets a Color3 from a Vector3, meant for Mesh.VertexColor
214 EXAMPLE USAGE: colourFromVector3(Vector3.new(0.83,0.2,0.5))
215 RETURNS: 0.83,0.2,0.5
216
217 >>getList() -- Gets entire list of names of provided colours in list
218 EXAMPLE USAGE: getList()
219 RETURNS: (all colours in colours.list, their names)
220
221 >>random() -- Gets a random colour from colours.list
222 EXAMPLE USAGE: random()
223 RETURNS: (random colour RGB) (and) (random colour name)
224
225<<-- colours ------------------
226
227 getChar(string s,number iterator) -- Gets a character from specified iteration of string
228 EXAMPLE USAGE: getChar("Bosho",3)
229 RETURNS: "s"
230
231 decimalPointLength(number) -- Gets the decimal length of a number
232 EXAMPLE USAGE: decimalPointLength(4.59)
233 RETURNS: 2
234
235 power10(number) -- Function intended for internal module functions, not intended for actual use
236 EXAMPLE USAGE: power10(5)
237 RETURNS: 100000
238
239 mathrandom(number num1,number num2,bool round)
240 EXAMPLE USAGE: mathrandom(2.4,8)
241 RETURNS: (any number between 2.4 & 8, with specified decimal length of the number with longest decimal length)
242
243 GetAllChildren(instance,bool turbo) -- Gets children of specified instance, does it quick but potentially laggy with turbo, likewise, slow & no-lag without
244 EXAMPLE USAGE: GetAllChildren(workspace,true)
245 RETURNS: (All children within workspace at "turbo" speed (no-wait()) )
246
247 antivirus() -- Checks through certain places for "viruses"
248 EXAMPLE USAGE: antivirus()
249 RETURNS: virusf (A file containing suspected viruses)
250
251 isodd(number) / iseven(number) -- Determines if a number is odd or even
252 EXAMPLE USAGE: isodd(3)
253 RETURNS: "odd"
254
255 toCharList(string) -- Converts a string to a table containing individual characters
256 EXAMPLE USAGE: "Honduras"
257 RETURNS: {"H","o","d","u","r","a","s"}
258
259 charlistToString(table) -- Intended as the reverse to "toCharList" -- not meant for any other purpose
260 EXAMPLE USAGE: charlistToString({"L","u","k","e"})
261 RETURNS: "Luke"
262
263conversion -- CVExtra.conversion (PREFIX functions/tables with conversion.)
264
265 >>addTo() -- Appends alternative forms of measurements to "conversions" list
266 EXAMPLE USAGE: addTo()
267 (Not intended for user/script use)
268
269 >>length -- CVExtra.conversion.length (PREFIX functions with length.)
270
271 >>>>conversions -- A list of preset measurements and their numbers
272
273 >>>>toMillimetres(string toConvertFrom,number)
274 EXAMPLE USAGE: toMillimetres("metre",1)
275 RETURNS: 1000
276
277 >>>>toCentimetres(string toConvertFrom,number)
278 EXAMPLE USAGE: toCentimetres("metre",2)
279 RETURNS: 200
280
281 >>>>toDecimetres(string toConvertFrom,number)
282 EXAMPLE USAGE: toDecimetres("centimetre",10)
283 RETURNS: 1
284
285 >>>>toStuds(string toConvertFrom,number)
286 EXAMPLE USAGE: toStuds("centimetre",80)
287 RETURNS: 4
288
289 >>>>toMetres(string toConvertFrom,number)
290 EXAMPLE USAGE: toMetres("centimetre",200)
291 RETURNS: 2
292
293 >>>>toKilometres(string toConvertFrom,number)
294 EXAMPLE USAGE: toKilometres("metres",1000)
295 RETURNS: 1
296
297 >>>>toInches(string toConvertFrom,number)
298 EXAMPLE USAGE: toInches("feet",2)
299 RETURNS: 24
300
301 >>>>toFeet(string toConvertFrom,number)
302 EXAMPLE USAGE: toFeet("inch",18)
303 RETURNS: 1.5
304
305 >>>>toYards(string toConvertFrom,number)
306 EXAMPLE USAGE: toYards("feet",6)
307 RETURNS: 2
308
309 >>>>toMiles(string toConvertFrom,number)
310 EXAMPLE USAGE: toMiles("feet",5280)
311 RETURNS: 1.0002137973897 (Supposed to be 1)
312
313 >>>>toNauticalMiles(string toConvertFrom,number)
314 EXAMPLE USAGE: toNauticalMiles("miles",1.16)
315 RETURNS: 1.0077969762419
316
317 >>>>Convert(string toConvertTo,string toConvertFrom,number FromUnits)
318 EXAMPLE USAGE: Convert("Stud","CM",40)
319 RETURNS: 2 (Studs)
320 <<-- length ------------------
321
322<<-- conversion ------------------
323
324
325--]]
326
327-- Module Scripts & Contents Below \/ \/ \/ \/
328
329
330wait(1)
331local CVExtra = {}
332CVExtra = {
333 numbify = function(s) -- Converts a string (with letters) to a number
334 -- 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
335 local result = nil
336 if type(s)=="string" then
337 local i = 1
338 local num = ""
339 local match = "[%d%.]+"
340 local negativecheck = true
341 while (i<=string.len(s)) do
342 if negativecheck == true and string.match(s.sub(s,i,i),"-") then
343 num = s.sub(s,i,i)
344 negativecheck = false
345 end
346 if string.match(s.sub(s,i,i),match) then
347 negativecheck = false
348 num = num..s.sub(s,i,i)
349 if (s.sub(s,i,i) == ".") then
350 match = "%d+"
351 end
352 end
353 i = i+1
354 end
355 result = tonumber(num)
356 elseif type(s)=="number" then
357 result = s
358 end
359 return result
360 end,
361 Math = {
362 round = function(num)
363 -- 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
364 local result = nil
365 if type(num) == "number" then
366 result = math.floor(num+0.5)
367 end
368 return result
369 end,
370 square = function(num) -- The mathematical operation "^" could be used alternatively: 4^2
371 -- EXAMPLE USAGE: square(4) -- squares (*2) the specified number, in this case, 4*4 = 16
372 local result = nil
373 if type(num)=="number" then
374 result = num*num
375 end
376 return result
377 end,
378 cube = function(num) -- The mathematical operation "^" could be used alternatively: 7^3
379 -- EXAMPLE USAGE: cube(7) -- cubes (*3) the specified number, in this case, 7*7*7 = 343
380 local result = nil
381 if type(num)=="number" then
382 result = num*num*num
383 end
384 return result
385 end,
386 area = function(num1,num2)
387 -- EXAMPLE USAGE: area(2,9) -- Gets the 2D area of the specified parameters, in this case, 2*9 is 18
388 local result = nil
389 if type(num1)=="number" and type(num2)=="number" then
390 result = num1*num2
391 end
392 return result
393 end,
394 volume = function(num1,num2,num3)
395 -- 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
396 local result = nil
397 if type(num1)=="number" and type(num2)=="number" and type(num3)=="number" then
398 result = (num1*num2)*num3
399 end
400 return result
401 end,
402 inverse = function(num) -- Returns the inverted form of a number
403 -- EXAMPLE USAGE: inverse(2) -- Will return -2
404 local result = nil
405 if type(num)=="number" then
406 result = num-(num*2)
407 end
408 return result
409 end,
410 },
411 randomPercentage = function(percent) -- makes a math random determining if the percent provided is higher than the random, returns true if so
412 -- EXAMPLE USAGE: randomPercentage(20)
413 if type(percent) == "number" then
414 local randomResult = math.random(1,100)
415 if randomResult <= percent then
416 return true
417 else
418 return false
419 end
420 else
421 return nil
422 end
423 end,
424 percent = function(num1,num2,round)
425 -- 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
426 local rawPercentage = (num1/num2)*100
427 local Percentage
428
429 -- REQUIRED FUNCTIONS:
430 local mround = CVExtra.Math.round
431 --
432
433 if round == true then
434 Percentage = mround(rawPercentage)
435 else
436 Percentage = rawPercentage
437 end
438 return Percentage
439 end,
440 capitalize = function(s) -- Capitalizes a string
441 -- EXAMPLE USAGE: capitalize("louis") -- Will capitalize specified string, in this case, "louis" to "Louis"
442 local newS = nil
443 if type(s) == "string" then
444 local newC = string.upper(string.sub(s,1,1))
445 local tempS = CVExtra.removeFirstLetter(s)
446 newS = newC..tempS
447 end
448 return newS
449 end,
450 printIndent = function(num) -- quite a useless function, is used for debugging output only
451 -- EXAMPLE USAGE: printIndent(2) -- Will print 2 spaces in output
452 if type(num) == "number" then
453 num = CVExtra.Math.round(num)
454 local i = 0
455 while (i < num) do
456 i = i + 1
457 if (i%2==0) then
458 print("")
459 else
460 print(" ")
461 end
462 end
463 end
464 end,
465 playAudio = function(aud,pbs,startime,endtime)
466 -- 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"
467
468 -- SELF-DEPENDENT FUNCTION
469 local playAudio = CVExtra.playAudio
470 --[[ How to have a self-dependent function:
471 -- Define it before the function appears, shown below:
472
473 local functionOfChoice
474 local functionOfChoice = function()
475 functionOfChoice()
476 end
477 --]]
478 --
479
480 local beginStart = startime
481 local beginEnd = endtime
482 local beginPBS = pbs
483
484 local Start = aud:FindFirstChild("Start")
485 local End = aud:FindFirstChild("End")
486 local timeStart = 0
487 local totalLength = aud.TimeLength
488 local PBS = aud.PlaybackSpeed
489 local timeEnd = aud.TimeLength
490 local totalPlayTime = timeEnd - timeStart
491 local PBSLength = totalPlayTime/PBS
492 local elasped = timeStart
493 local espInc = 0.03 -- elasped increment
494 local function play()
495 aud.TimePosition = timeStart
496 aud:Play()
497 repeat --wait(math.ceil(PBSLength))
498 wait(0.1)
499 repeat
500 wait(0.1)
501 until aud.isPaused == false
502 until aud.TimePosition >= timeEnd
503 aud:Stop()
504 wait()
505 if aud.Looped == true then
506 playAudio(aud,beginPBS,beginStart,beginEnd)
507 end
508 end
509 local function PBSUpdate(p)
510 PBS = aud.PlaybackSpeed
511 timeEnd = timeEnd/PBS
512 end
513 aud.Changed:connect(PBSUpdate)
514 if type(pbs)=="number" then
515 PBS = pbs
516 end
517 if Start == nil then
518 if type(startime)=="number" then
519 timeStart = startime
520 end
521 else
522 if Start:IsA("NumberValue") and Start.Value < aud.TimeLength then
523 timeStart = Start.Value
524 end
525 end
526 if End == nil then
527 if type(endtime)=="number" then
528 timeEnd = endtime
529 end
530 else
531 if End:IsA("NumberValue") then
532 if End.Value > aud.TimeLength then
533 End.Value = aud.TimeLength
534 end
535 timeEnd = End.Value
536 end
537 end
538 totalPlayTime = (timeEnd/PBS/(1/PBS)) - (timeStart/PBS/(1/PBS))
539 elasped = timeStart
540 PBSLength = totalPlayTime
541 play()
542 end,
543 getPlayer = function(s) -- Use of function is intended for other CVExtra functions.
544 -- EXAMPLE USAGE: getPlayer("Cvieyra2test") -- Gets user of the string mentioned, returns nil if it cannot find them
545 local returnT = nil
546 local players = game:GetService("Players")
547 if type(s)=="string" then
548 for i,plr in pairs(players:GetPlayers()) do
549 if plr.Name == s then
550 returnT = plr
551 break
552 end
553 wait()
554 end
555 else
556 warn("getPlayer cannot get name from provided instance")
557 end
558 return returnT
559 end,
560 createleaderStats = function(plr)
561 -- 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
562 local returnT = nil
563 local getPlayer = CVExtra.getPlayer
564 if type(plr) == "string" then
565 plr = getPlayer(plr)
566 end
567 if typeof(plr) == "Instance" then
568 if plr:IsA("Player") then
569 local a = plr:FindFirstChild("leaderstats")
570 local function createLeaderStats()
571 local leaderstats = Instance.new("Model",plr)
572 leaderstats.Name = "leaderstats"
573 returnT = leaderstats
574 end
575 if a and a:IsA("Model") then
576 warn("createleaderStats: Found a pre-existing leaderstats!")
577 else
578 if a then
579 a.Parent = nil
580 createLeaderStats()
581 else
582 createLeaderStats()
583 end
584 end
585 else
586 warn("createleaderStats: Only provide a player, not a "..plr.ClassName)
587 end
588 else
589 warn("createleaderStats: Only provide an instance, not anything else!")
590 end
591 return returnT
592 end,
593 clean = function(con,specification,turbo) -- deletes empty 'specifications' of a container
594 -- EXAMPLE USAGE: clean(game.Workspace,model,false) -- would delete all instances of empty "models" in game.Workspace
595 local turboV = false -- either it does it quick or fast -- fast can cause lag but does it in a jiffy!
596 local cap = CVExtra.capitalize
597 if type(turbo)=="boolean" then -- Also it must be specified true or false!
598 turboV = turbo
599 end
600 if type(specification)=="string" then
601 specification = cap(specification)
602 elseif typeof(specification)=="Instance" then
603 specification = specification.ClassName
604 end
605 if typeof(con)=="Instance" then
606 local b = Instance.new(specification)
607 if b then
608 local content = con:GetChildren()
609 for i,v in pairs(content) do
610 if #v:GetDescendants()==0 then
611 if v:IsA(specification) then
612 v.Parent = nil
613 end
614 end
615 if turboV == true then
616 else
617 wait()
618 end
619 end
620 else
621 warn("clean: Specified instance is not valid!")
622 end
623 else
624 warn("clean: Requires an instance to clean in!")
625 end
626 end,
627 cleanHats = function(turbo) -- Cleans hats in the workspace
628 -- 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
629 local turboV = false
630 if type(turbo)=="boolean" then
631 turboV = turbo
632 end
633 local b = workspace:GetChildren()
634 for i,v in pairs(b) do
635 if v:IsA("Hat") or v:IsA("Accessory") then
636 v.Parent = nil
637 end
638 if turboV == true then
639 else
640 wait()
641 end
642 end
643 end,
644 areaOf = function(instance) -- Gets the area of an object (for a square, thus triangles or circles will not be calculated appropriately)
645 -- 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
646 local result = nil
647 local area = CVExtra.Math.area
648 if typeof(instance)=="Instance" then
649 if instance:IsA("GuiObject") then
650 result = area(instance.Size.X,instance.Size.Y)
651 elseif instance:IsA("BasePart") then
652 result = area(instance.Size.X,instance.Size.Z)
653 else
654 warn("CVExtra.areaOf: instance is not a BasePart or GUIObject!")
655 end
656 end
657 return result
658 end,
659 volumeOf = function(instance) -- Gets the volume of an object (for a cube, thus triangular prisms or spheres will not be calculated appropriately)
660 -- 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
661 local result = nil
662 local result = nil
663 local volume = CVExtra.Math.volume
664 if typeof(instance)=="Instance" then
665 if instance:IsA("BasePart") then
666 result = volume(instance.Size.X,instance.Size.Y,instance.Size.Z)
667 else
668 warn("CVExtra.volumeOf: instance is not a BasePart!")
669 end
670 end
671 return result
672 end,
673 colours = { -- Just custom colours. -- You can grab one by doing: colours.list.highlighter -- to get "Highlighter"
674 list = {
675 -- EXAMPLE USAGE: game.Workspace.Color = colours.list.trueorange -- Would colour the first object named "Part" in game.Workspace to "trueorange" (RGB: 255,100,0)
676 -- BASE ROBLOX GUI COLOURS
677 ["earth green"]=Color3.fromRGB(39,70,45),
678 ["slime green"]=Color3.fromRGB(80,109,84),
679 ["bright bluish green"]=Color3.fromRGB(0,143,156),
680 ["black"]=Color3.fromRGB(27,42,53),
681 ["deep blue"]=Color3.fromRGB(33,84,185),
682 ["dark blue"]=Color3.fromRGB(0,16,176),
683 ["navy blue"]=Color3.fromRGB(0,32,96),
684 ["parsley green"]=Color3.fromRGB(44,101,29),
685 ["dark green"]=Color3.fromRGB(40,127,71),
686 ["teal"]=Color3.fromRGB(18,238,212),
687 ["smoky grey"]=Color3.fromRGB(91,93,105),
688 ["steel blue"]=Color3.fromRGB(82,124,174),
689 ["storm blue"]=Color3.fromRGB(51,88,130),
690 ["lapis"]=Color3.fromRGB(16,42,220),
691 ["dark indigo"]=Color3.fromRGB(61,21,133),
692 ["camo"]=Color3.fromRGB(58,125,21),
693 ["sea green"]=Color3.fromRGB(52,142,64),
694 ["shamrock"]=Color3.fromRGB(91,154,76),
695 ["toothpaste"]=Color3.fromRGB(0,255,255),
696 ["sand blue"]=Color3.fromRGB(116,134,157),
697 ["medium blue"]=Color3.fromRGB(110,153,202),
698 ["bright blue"]=Color3.fromRGB(13,105,172),
699 ["really blue"]=Color3.fromRGB(0,0,255),
700 ["mulberry"]=Color3.fromRGB(89,34,89),
701 ["forest green"]=Color3.fromRGB(31,128,29),
702 ["bright green"]=Color3.fromRGB(75,151,75),
703 ["grime"]=Color3.fromRGB(127,142,100),
704 ["lime green"]=Color3.fromRGB(0,255,0),
705 ["pastel blue-green"]=Color3.fromRGB(159,243,233),
706 ["fossil"]=Color3.fromRGB(159,161,172),
707 ["electric blue"]=Color3.fromRGB(9,137,207),
708 ["lavender"]=Color3.fromRGB(140,91,159),
709 ["royal purple"]=Color3.fromRGB(98,37,209),
710 ["eggplant"]=Color3.fromRGB(123,0,123),
711 ["sand green"]=Color3.fromRGB(120,144,130),
712 ["moss"]=Color3.fromRGB(124,156,107),
713 ["artichoke"]=Color3.fromRGB(138,171,133),
714 ["sage green"]=Color3.fromRGB(185,196,177),
715 ["pastel light blue"]=Color3.fromRGB(175,221,255),
716 ["cadet blue"]=Color3.fromRGB(159,173,192),
717 ["cyan"]=Color3.fromRGB(4,175,236),
718 ["alder"]=Color3.fromRGB(180,128,255),
719 ["lilac"]=Color3.fromRGB(167,94,155),
720 ["plum"]=Color3.fromRGB(123,47,123),
721 ["bright violet"]=Color3.fromRGB(107,50,124),
722 ["olive"]=Color3.fromRGB(193,190,66),
723 ["br. yellowish green"]=Color3.fromRGB(164,189,71),
724 ["olivine"]=Color3.fromRGB(148,190,129),
725 ["laurel green"]=Color3.fromRGB(168,189,153),
726 ["quill grey"]=Color3.fromRGB(223,223,222),
727 ["ghost grey"]=Color3.fromRGB(202,203,209),
728 ["pastel blue"]=Color3.fromRGB(128,187,219),
729 ["pastel violet"]=Color3.fromRGB(177,167,255),
730 ["pink"]=Color3.fromRGB(255,102,204),
731 ["hot pink"]=Color3.fromRGB(255,0,191),
732 ["magenta"]=Color3.fromRGB(170,0,170),
733 ["crimson"]=Color3.fromRGB(151,0,0),
734 ["deep orange"]=Color3.fromRGB(255,176,0),
735 ["new yeller"]=Color3.fromRGB(255,255,0),
736 ["medium green"]=Color3.fromRGB(161,196,140),
737 ["mint"]=Color3.fromRGB(177,229,166),
738 ["pastel green"]=Color3.fromRGB(204,255,204),
739 ["light stone grey"]=Color3.fromRGB(229,228,223),
740 ["light blue"]=Color3.fromRGB(180,210,228),
741 ["baby blue"]=Color3.fromRGB(152,194,219),
742 ["carnation pink"]=Color3.fromRGB(255,152,220),
743 ["persimmon"]=Color3.fromRGB(255,89,89),
744 ["really red"]=Color3.fromRGB(255,0,0),
745 ["bright red"]=Color3.fromRGB(196,40,28),
746 ["maroon"]=Color3.fromRGB(117,0,0),
747 ["gold"]=Color3.fromRGB(239,184,56),
748 ["bright yellow"]=Color3.fromRGB(245,205,48),
749 ["daisy orange"]=Color3.fromRGB(248,217,109),
750 ["cool yellow"]=Color3.fromRGB(253,234,141),
751 ["pastel yellow"]=Color3.fromRGB(255,255,204),
752 ["pearl"]=Color3.fromRGB(231,231,236),
753 ["fog"]=Color3.fromRGB(199,212,228),
754 ["mauve"]=Color3.fromRGB(224,178,208),
755 ["sunrise"]=Color3.fromRGB(212,144,189),
756 ["terra cotta"]=Color3.fromRGB(190,104,98),
757 ["dusty rose"]=Color3.fromRGB(163,75,75),
758 ["cocoa"]=Color3.fromRGB(86,36,36),
759 ["neon orange"]=Color3.fromRGB(213,115,61),
760 ["bright orange"]=Color3.fromRGB(218,133,65),
761 ["wheat"]=Color3.fromRGB(241,231,199),
762 ["buttermilk"]=Color3.fromRGB(254,243,187),
763 ["institutional white"]=Color3.fromRGB(248,248,248),
764 ["white"]=Color3.fromRGB(242,243,243),
765 ["light reddish violet"]=Color3.fromRGB(232,186,200),
766 ["pastel orange"]=Color3.fromRGB(255,101,201),
767 ["salmon"]=Color3.fromRGB(255,148,148),
768 ["tawny"]=Color3.fromRGB(150,85,85),
769 ["rust"]=Color3.fromRGB(143,76,42),
770 ["cga brown"]=Color3.fromRGB(170,85,0),
771 ["br. yellowish orange"]=Color3.fromRGB(226,155,64),
772 ["cashmere"]=Color3.fromRGB(211,190,150),
773 ["khaki"]=Color3.fromRGB(226,220,188),
774 ["lily white"]=Color3.fromRGB(237,234,234),
775 ["seashell"]=Color3.fromRGB(233,218,218),
776 ["pastel brown"]=Color3.fromRGB(255,204,153),
777 ["light orange"]=Color3.fromRGB(234,184,146),
778 ["medium red"]=Color3.fromRGB(218,134,122),
779 ["burgundy"]=Color3.fromRGB(136,62,62),
780 ["reddish brown"]=Color3.fromRGB(105,64,40),
781 ["cork"]=Color3.fromRGB(188,155,93),
782 ["burlap"]=Color3.fromRGB(199,172,120),
783 ["beige"]=Color3.fromRGB(202,191,163),
784 ["oyster"]=Color3.fromRGB(187,179,178),
785 ["mid gray"]=Color3.fromRGB(205,205,205),
786 ["brick yellow"]=Color3.fromRGB(215,197,154),
787 ["nougat"]=Color3.fromRGB(204,142,105),
788 ["brown"]=Color3.fromRGB(124,92,70),
789 ["pine cone"]=Color3.fromRGB(108,88,75),
790 ["fawn brown"]=Color3.fromRGB(160,132,79),
791 ["sand red"]=Color3.fromRGB(149,121,119),
792 ["hurricane grey"]=Color3.fromRGB(149,137,136),
793 ["cloudy grey"]=Color3.fromRGB(171,168,158),
794 ["linen"]=Color3.fromRGB(175,148,131),
795 ["copper"]=Color3.fromRGB(150,103,102),
796 ["dark orange"]=Color3.fromRGB(160,95,53),
797 ["dirt brown"]=Color3.fromRGB(86,66,54),
798 ["bronze"]=Color3.fromRGB(126,104,63),
799 ["dark stone grey"]=Color3.fromRGB(99,95,98),
800 ["medium stone grey"]=Color3.fromRGB(163,162,165),
801 ["flint"]=Color3.fromRGB(105,102,92),
802 ["dark taupe"]=Color3.fromRGB(90,76,66),
803 ["burnt sienna"]=Color3.fromRGB(106,57,9),
804 ["really black"]=Color3.fromRGB(17,17,17),
805 -- OTHER BASE ROBLOX COLOURS
806 ["light orange brown"]=Color3.fromRGB(203,132,66),
807 ["med. reddish violet"]=Color3.fromRGB(196,112,160),
808 ["earth orange"]=Color3.fromRGB(98,71,50),
809 ["lig. yellowich orange"]=Color3.fromRGB(243,207,155),
810 ["light bluish violet"]=Color3.fromRGB(193,202,222),
811 ["transparent"]=Color3.fromRGB(236,236,236),
812 ["tr. red"]=Color3.fromRGB(205,84,75),
813 ["tr. lg blue"]=Color3.fromRGB(193,223,240),
814 ["tr. yellow"]=Color3.fromRGB(247,241,141),
815 ["tr. flu. reddish orange"]=Color3.fromRGB(217,133,108),
816 ["tr. green"]=Color3.fromRGB(132,182,141),
817 ["tr. flu. green"]=Color3.fromRGB(248,241,132),
818 ["phosph. white"]=Color3.fromRGB(236,232,222),
819 ["light red"]=Color3.fromRGB(238,196,182),
820 ["earth yellow"]=Color3.fromRGB(104,92,67),
821 ["bright bluish violet"]=Color3.fromRGB(67,84,147),
822 ["tr. brown"]=Color3.fromRGB(191,183,177),
823 ["medium bluish violet"]=Color3.fromRGB(104,116,172),
824 ["tr. medi. reddish violet"]=Color3.fromRGB(229,173,200),
825 ["med. yellowish green"]=Color3.fromRGB(199,210,60),
826 ["med. bluish green"]=Color3.fromRGB(85,165,175),
827 ["light bluish green"]=Color3.fromRGB(183,215,213),
828 ["lig. yellowish green"]=Color3.fromRGB(217,228,167),
829 ["med. yellowish orange"]=Color3.fromRGB(231,172,88),
830 ["br. reddish orange"]=Color3.fromRGB(211,111,76),
831 ["bright reddish violet"]=Color3.fromRGB(146,57,120),
832 ["tr. bright bluish violet"]=Color3.fromRGB(165,165,203),
833 ["dark nougat"]=Color3.fromRGB(174,122,89),
834 ["silver"]=Color3.fromRGB(156,163,168),
835 ["neon green"]=Color3.fromRGB(216,221,86),
836 ["sand violet"]=Color3.fromRGB(135,124,144),
837 ["medium orange"]=Color3.fromRGB(224,152,100),
838 ["sand yellow"]=Color3.fromRGB(149,138,115),
839 ["earth blue"]=Color3.fromRGB(32,58,86),
840 ["tr. flu. blue"]=Color3.fromRGB(207,226,247),
841 ["sand blue metallic"]=Color3.fromRGB(121,136,161),
842 ["sand violet metallic"]=Color3.fromRGB(149,142,163),
843 ["sand yellow metallic"]=Color3.fromRGB(147,135,103),
844 ["dark grey metallic"]=Color3.fromRGB(87,88,87),
845 ["black metallic"]=Color3.fromRGB(22,29,50),
846 ["light grey metallic"]=Color3.fromRGB(171,173,172),
847 ["dark red"]=Color3.fromRGB(123,46,47),
848 ["tr. flu yellow"]=Color3.fromRGB(255,246,123),
849 ["tr. flu. red"]=Color3.fromRGB(225,164,194),
850 ["gun metallic"]=Color3.fromRGB(117,108,98),
851 ["red flip/flop"]=Color3.fromRGB(151,105,91),
852 ["yellow flip/flop"]=Color3.fromRGB(180,132,85),
853 ["silver flip/flop"]=Color3.fromRGB(137,135,136),
854 ["curry"]=Color3.fromRGB(215,169,75),
855 ["fire yellow"]=Color3.fromRGB(249,214,46),
856 ["flame yellowish orange"]=Color3.fromRGB(232,171,45),
857 ["flame reddish orange"]=Color3.fromRGB(207,96,36),
858 ["royal blue"]=Color3.fromRGB(70,103,164),
859 ["dark royal blue"]=Color3.fromRGB(35,71,139),
860 ["bright reddish lilac"]=Color3.fromRGB(9142,66,133),
861 ["lemon metallic"]=Color3.fromRGB(130,138,93),
862 ["dark curry"]=Color3.fromRGB(176,142,68),
863 ["faded green"]=Color3.fromRGB(112,149,120),
864 ["turquoise"]=Color3.fromRGB(121,181,181),
865 ["light royal blue"]=Color3.fromRGB(159,195,233),
866 ["medium royal blue"]=Color3.fromRGB(108,129,183),
867 ["reddish lilac"]=Color3.fromRGB(150,112,159),
868 ["light lilac"]=Color3.fromRGB(167,169,206),
869 ["bright purple"]=Color3.fromRGB(205,98,152),
870 ["light purple"]=Color3.fromRGB(228,173,200),
871 ["light pink"]=Color3.fromRGB(220,144,149),
872 ["light brick yellow"]=Color3.fromRGB(240,213,160),
873 ["warm yellowish orange"]=Color3.fromRGB(235,184,127),
874 ["dove blue"]=Color3.fromRGB(125,187,221),
875 ["medium lilac"]=Color3.fromRGB(52,43,117),
876 -- ABSOLUTE COLOURS
877 ["red"]=Color3.fromRGB(255,0,0),
878 ["green"]=Color3.fromRGB(0,255,0),
879 ["blue"]=Color3.fromRGB(0,0,255),
880 ["yellow"]=Color3.fromRGB(255,255,0),
881 ["purple"]=Color3.fromRGB(255,0,255),
882 ["absolute black"]=Color3.fromRGB(0,0,0),
883 ["absolute white"]=Color3.fromRGB(255,255,255),
884 -- CV CUSTOM COLOURS
885 ["red orange"] = Color3.fromRGB(255,70,0),
886 ["pumpkin orange"] = Color3.fromRGB(255,90,0),
887 ["trueorange"] = Color3.fromRGB(255,100,0),
888 ["highlighter"] = Color3.fromRGB(220, 255, 0),
889 ["cucumber"] = Color3.fromRGB(78,101,74),
890 ["pyrite"] = Color3.fromRGB(138,125,94),
891 ["firebrick"] = Color3.fromRGB(178,34,34),
892 ["soapgreen"]=Color3.fromRGB(0,255,127),
893 ["fluorescent butter"]=Color3.fromRGB(255,246,123),
894 ["pupil"]=Color3.fromRGB(4,4,6),
895 ["mediterranean"]=Color3.fromRGB(70,190,200),
896 ["slate grey"]=Color3.fromRGB(112,128,144),
897 ["vanilla"]=Color3.fromRGB(255,254,221),
898 ["grapefruit"]=Color3.fromRGB(229,58,55),
899 ["caramel"]=Color3.fromRGB(185,93,1),
900 ["carpetberry"]=Color3.fromRGB(94,40,52),
901 ["butter"]=Color3.fromRGB(230,220,111),
902 ["mango"]=Color3.fromRGB(253,171,0),
903 ["chocolate"]=Color3.fromRGB(105,64,20),
904 ["peach"]=Color3.fromRGB(255,134,48),
905 ["grass"]=Color3.fromRGB(0,170,0),
906 },
907 addColour = function(cname,rgb) -- Adds a customized colour to the colours table, returns colour's RGB back to what called function
908 -- 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)
909 local result = nil
910 local rgbnew = Color3.fromRGB(rgb)
911 local colours = CVExtra.colours.list
912 if type(cname)=="string" then
913 cname = cname:lower()
914 if colours[cname] == nil then
915 colours[cname] = rgbnew
916 result = colours[cname]
917 else
918 warn("CVExtra.colours.addColour: Colour already exists in CVExtra.colours!")
919 end
920 end
921 return result
922 end,
923 getColour = function(s) -- Gets a colour from list if the provided string is a name found in the list
924 -- EXAMPLE USAGE: getColour("pupil") -- Will return the colour of "pupil" in RGB
925 local result = nil
926 local colours = CVExtra.colours.list
927 local round = CVExtra.Math.round
928 local getList = CVExtra.colours.getList
929 if type(s) == "string" then
930 s = s:lower()
931 if colours[s] then
932 result = colours[s]
933 else
934 warn("CVExtra.colours.getColour: Couldn't find colour: "..s.."!")
935 end
936 elseif type(s)=="number" then
937 if round(s)>0 then
938 local list = getList()
939 local picked = list[s]
940 if picked then
941 local colour = colours[picked]
942 return colour,picked
943 else
944 warn("CVExtra.colours.getColour: Couldn't find colour of iteration: "..s.."!")
945 end
946 end
947 end
948 return result
949 end,
950 darken = function(rgb,amount) -- Amount must range from 0-100!
951 local result = nil
952 if type(amount)=="number" then
953 if typeof(rgb)=="Color3" then
954 local amountd = amount/100
955 local HSVt = {0,0,0}
956 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
957 HSVt[3]=HSVt[3]-amountd
958 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
959 if HSVt[3]-amountd>0 and HSVt[3]-amountd<=1 then
960
961 elseif HSVt[3]-amountd<=0 then
962 HSV = Color3.fromHSV(HSVt[1],HSVt[2],0)
963 elseif HSVt[3]-amountd>1 then
964 HSVt[3]=1
965 HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
966 end
967 result = HSV
968 end
969 end
970 return result
971 end,
972 lighten = function(rgb,amount) -- Amount must range from 0-100!
973 local result = nil
974 local inverse = CVExtra.Math.inverse
975 local darken = CVExtra.colours.darken
976 result = darken(rgb,inverse(amount))
977 return result
978 end,
979 desaturate = function(rgb,amount) -- Amount must range from 0-100!
980 local result = nil
981 if type(amount)=="number" then
982 if typeof(rgb)=="Color3" then
983 local amountd = amount/100
984 local HSVt = {0,0,0}
985 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
986 HSVt[2]=HSVt[2]-amountd
987 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
988 if HSVt[2]-amountd>0 and HSVt[2]-amountd<=1 then
989
990 elseif HSVt[2]-amountd<=0 then
991 HSV = Color3.fromHSV(HSVt[1],0,HSVt[3])
992 elseif HSVt[2]-amountd>1 then
993 HSVt[2]=1
994 HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
995 end
996 result = HSV
997 end
998 end
999 return result
1000 end,
1001 saturate = function(rgb,amount) -- Amount must range from 0-100!
1002 local result = nil
1003 local inverse = CVExtra.Math.inverse
1004 local saturate = CVExtra.colours.desaturate
1005 result = saturate(rgb,inverse(amount))
1006 return result
1007 end,
1008 colourFromHex = 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
1009 local r = math.floor(hex/65536)%256
1010 local g = math.floor(hex/256)%256
1011 local b = math.floor(hex%256)
1012 return Color3.new(r/255,g/255,b/255)
1013 end,
1014 colourFromVector3 = function(v3)
1015 local result
1016 if typeof(v3)=="Vector3" then
1017 local vec = Vector3.new(v3.X,v3.Y,v3.Z)
1018 local v0 = vec.X
1019 local v1 = vec.Y
1020 local v2 = vec.Z
1021 if v0>1 then
1022 v0=1
1023 end
1024 if v1>1 then
1025 v1=1
1026 end
1027 if v2>1 then
1028 v2=1
1029 end
1030 local color = Color3.new(v0,v1,v2)
1031 result = color
1032 end
1033 return result
1034 end,
1035 Color3toRGB = function(color3)
1036 local result
1037 local r
1038 local g
1039 local b
1040 if typeof(color3)=="Color3" then
1041 if color3.r<=1 and color3.g<=1 and color3.b<=1 then
1042 r = math.floor(color3.r*255)
1043 g = math.floor(color3.g*255)
1044 b = math.floor(color3.b*255)
1045 end
1046 end
1047 return r,g,b
1048 end,
1049 getList = function()
1050 local result = nil
1051 local list = CVExtra.colours.list
1052 local cap = CVExtra.capitalize
1053 local names = {}
1054 for name,val in pairs(list) do
1055 table.insert(names,name)
1056 end
1057 result = names
1058 return result
1059 end,
1060 random = function()
1061 local list = CVExtra.colours.list
1062 local glist = CVExtra.colours.getList()
1063 local listl = #glist
1064 local iter = math.random(1,listl)
1065 local c = glist[iter]
1066 local cc = list[c]
1067 return cc,c
1068 end,
1069 colourMix = function(rgb,rgb2) -- WIP, HSV-BASED
1070 local inverse = CVExtra.Math.inverse
1071 if typeof(rgb)=="Color3" and typeof(rgb)=="Color3" then
1072 local HSVt = {0,0,0}
1073 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
1074 print(HSVt[1],HSVt[2],HSVt[3])
1075 local HSVt2 = {0,0,0}
1076 HSVt2[1],HSVt2[2],HSVt2[3]=Color3.toHSV(rgb2)
1077 print(HSVt2[1],HSVt2[2],HSVt2[3])
1078 local Hue = HSVt[1]+HSVt2[1]
1079 if Hue>1 and Hue<2 then
1080 Hue = (Hue-1)-math.floor(Hue)
1081 Hue = inverse(Hue)
1082 elseif Hue>=2 then
1083 Hue = 1
1084 end
1085 local Sat = HSVt[2]-HSVt2[2]
1086 if Sat<0 then
1087 Sat = inverse(Sat)
1088 elseif Sat==0 then
1089 Sat=Sat+0.01
1090 end
1091 local Val = HSVt[3]-HSVt2[3]
1092 if Val<0 then
1093 Val=inverse(Val)
1094 elseif Val==0 then
1095 Val=Val+0.01
1096 end
1097 print(Hue)
1098 print(Sat)
1099 print(Val)
1100 local newHSV = Color3.fromHSV(Hue*359,Sat*255,Val*255)
1101 return newHSV
1102 end
1103 end,
1104 colourMix2 = function(rgb,rgb2) -- WIP, RGB-BASED
1105
1106 end,
1107 },
1108 getChar = function(s,iterator) -- Gets a char from a string and the specified iteration of the string
1109 -- EXAMPLE USAGE: getChar("Galtus",2) -- Would get the 2nd iteration of the string, in this case, "a" from "Galtus"
1110 local result = nil
1111 if type(s)=="string" then
1112 result = (s.sub(s,iterator,iterator))
1113 elseif type(s)=="number" then
1114 s = ""+s
1115 result = (s.sub(s,iterator,iterator))
1116 end
1117 return result
1118 end,
1119 decimalPointLength = function(num) -- Gets the amount of characters after the decimal point
1120 -- 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
1121 local result = nil
1122 local numbify = CVExtra.numbify
1123 local getChar = CVExtra.getChar
1124 local tnum = 0
1125 local wholelength = 0
1126 local decimallength = 0
1127 local confirmed = false
1128 if type(num)=="number" then
1129 tnum = num
1130 confirmed = true
1131 elseif type(num)=="string" then
1132 tnum = numbify(num)
1133 confirmed = true
1134 end
1135 if confirmed==true then
1136 local i = 1
1137 local anum = ""..tnum
1138 local match = "%.+"
1139 repeat
1140 i = i+1
1141 until (i>=string.len(anum)) or getChar(anum,i)=="."
1142 wholelength = i
1143 decimallength = string.len(anum)-wholelength
1144 if decimallength<0 then
1145 decimallength=0
1146 end
1147 result = decimallength
1148 end
1149 return result
1150 end,
1151 power10 = function(num) -- Gets 10 multiplied by 10 by how many numbers are provided (rounded) -- "power"
1152 -- EXAMPLE USAGE: power10(2) -- Will return "100" since 10 to the power of 2 is 100, 10*10 (2 10's) = 100
1153 local result = nil
1154 local round = CVExtra.Math.round
1155 if type(num)=="number" then
1156 num = round(num)
1157 local i = 1
1158 local power = 1
1159 while (i<=num) do
1160 power = power*10
1161 i = i+1
1162 end
1163 result = power
1164 end
1165 return result
1166 end,
1167 mathrandom = function(num1,num2,round) -- Returns a randomnized number, accepts decimal points unlike Roblox's math.random
1168 -- 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
1169 local result = nil
1170 local getDPL = CVExtra.decimalPointLength
1171 local round = CVExtra.Math.round
1172 local power10 = CVExtra.power10
1173 local dplength = 0
1174 if type(num1)=="number" and type(num2)=="number" then
1175 if getDPL(num1)>getDPL(num2) then
1176 dplength = getDPL(num1)
1177 elseif getDPL(num1)<getDPL(num2) then
1178 dplength = getDPL(num2)
1179 else
1180 dplength = getDPL(num1)
1181 end
1182 local totime = power10(dplength)
1183 local rnum = math.random(num1*totime,num2*totime)
1184 result = rnum/totime
1185 end
1186 return result
1187 end,
1188 GetAllChildren = function(instance,turbo) -- Gets ALL children of an instance and returns them!
1189 -- EXAMPLE USAGE: GetAllChildren(game.Workspace) -- Will return EVERY single child in the ENTIRETY of the workspace!
1190 local result = nil
1191 local children = {}
1192 local function getChildren(obj)
1193 local am = obj:GetChildren()
1194 local bm
1195 if #am>0 then
1196 for i,v in pairs(am) do
1197 table.insert(children,v)
1198 bm = v:GetChildren()
1199 if #bm>0 then
1200 getChildren(v)
1201 end
1202 if turbo == true then
1203
1204 else
1205 wait()
1206 end
1207 end
1208 end
1209 end
1210 if typeof(instance)=="Instance" then
1211 getChildren(instance)
1212 else
1213 warn("CVExtra.GetAllChildren: an instance must be provided!")
1214 end
1215 if #children>=1 then
1216 result = children
1217 end
1218 return result
1219 end,
1220 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
1221 -- 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
1222 local result = nil
1223 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}
1224 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",[[""''""''""�|`�]]}
1225 local virusf = Instance.new("Folder")
1226 virusf.Name = "CVViruses"
1227 local virustat = Instance.new("StringValue")
1228 virustat.Name = "Virus Destination"
1229 local virusesfound = {}
1230 local wiq = game:FindFirstChild("CVViruses")
1231 if wiq then
1232 virusf = wiq
1233 end
1234 for i,h in pairs(places) do
1235 virusesfound[i] = 0
1236 end
1237 local virustotal = 0
1238 local GAC = CVExtra.GetAllChildren
1239 warn("CVExtra.antivirus: Scan initiated!")
1240 local de = 1
1241 for i,p in pairs(places) do
1242 local c = GAC(p,true)
1243 local e = 0
1244 if c==nil then
1245
1246 else
1247 warn("CVExtra.antivirus: Scanning "..p.Name)
1248
1249 local new = 0
1250 local newf = Instance.new("Folder")
1251 for i,v in pairs(c) do
1252 if v:IsA("BaseScript") then
1253 for i,a in pairs(lookfor) do
1254 if v.Name:lower()==a:lower() then
1255 v.Disabled = true
1256 if v:FindFirstChild("Virus Destination")==nil then
1257 local sod = virustat:clone()
1258 sod.Value = v:GetFullName()
1259 sod.Parent = v
1260 end
1261 v.Parent = newf
1262 end
1263 end
1264 else
1265
1266 end
1267 end
1268 local ak = newf:GetChildren()
1269 e = #ak
1270 virusesfound[de] = e
1271 for i,q in pairs(ak) do
1272 q.Parent = virusf
1273 end
1274 virustotal = virustotal+e
1275 warn("CVExtra.antivirus: "..e.." virus(es) found in "..p.Name)
1276 print("")
1277 print(" ")
1278 e = 0
1279 de = de+1
1280 wait()
1281 end
1282 end
1283 virusf.Parent = game
1284 result = virusf
1285 warn("CVExtra.antivirus: "..virustotal.." virus(es) were found in your place!")
1286 return result
1287 end,
1288 isodd = function(num) -- Tells if a number is odd or even *--* iseven can be used alternatively
1289 -- EXAMPLE USAGE: isodd(num) -- Returns string, "even" or "odd" if it is even or odd || iseven(num) -- works alternatively
1290 local result = nil
1291 if type(num)=="number" then
1292 if num%2==0 then
1293 result = "even"
1294 elseif num%2==1 then
1295 result = "odd"
1296 end
1297 else
1298
1299 end
1300 return result
1301 end,
1302 iseven = function(num)
1303 local isodd = CVExtra.isodd
1304 local result
1305 result = isodd(num)
1306 return result
1307 end,
1308 toCharList = function(s) -- Turns a string into a list of characters
1309 -- EXAMPLE USAGE: toCharList("Dawrus") -- Will get every character of the provided string, then return it as a table of characters
1310 local result = nil
1311 local getChar = CVExtra.getChar
1312 local charlist = {}
1313 if type(s)=="string" then
1314 local i = 1
1315 while (i<=s:len()) do
1316 charlist[i] = getChar(s,i)
1317 i = i+1
1318 end
1319 result = charlist
1320 end
1321 return result
1322 end,
1323 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")
1324 -- EXAMPLE USAGE: charlistToString({"A","v","e","r","y"}) -- Will create a string using the items specified in the table, ignoring non-string
1325 local result = nil
1326 if type(t)=="table" then
1327 local String = ""
1328 for i,v in pairs(t) do
1329 if type(v)=="string" then
1330 String = String..v
1331 end
1332 end
1333 if String:len()>0 then
1334 result = String
1335 else
1336
1337 end
1338 end
1339 return result
1340 end,
1341 conversion = { -- Metric & Imperial measurements
1342 addTo = function()
1343 local conversion = CVExtra.conversion
1344 local length = conversion.length
1345 local liquid = conversion.liquid
1346 local lenconversions = length.conversions
1347 if lenconversions["mm"] then
1348
1349 else
1350 lenconversions["mm"]=(lenconversions.millimetre)
1351 lenconversions["millimetres"]=(lenconversions.millimetre)
1352 lenconversions["millimeter"]=(lenconversions.millimetre)
1353 lenconversions["millimeters"]=(lenconversions.millimetre)
1354 length["toMillimeters"]=(length.toMillimetres)
1355 wait()
1356 lenconversions["centimetres"]=(lenconversions.centimetre)
1357 lenconversions["centimeter"]=(lenconversions.centimetre)
1358 lenconversions["centimeters"]=(lenconversions.centimetre)
1359 lenconversions["cm"]=(lenconversions.centimetre)
1360 length["toCentimeters"]=(length.toCentimetres)
1361 wait()
1362 lenconversions["decimetres"]=(lenconversions.decimetre)
1363 lenconversions["decimeter"]=(lenconversions.decimetre)
1364 lenconversions["decimeters"]=(lenconversions.decimetre)
1365 lenconversions["dm"]=(lenconversions.decimetre)
1366 length["toDecimeters"]=(length.toDecimetres)
1367 wait()
1368 lenconversions["metres"]=(lenconversions.metre)
1369 lenconversions["meter"]=(lenconversions.metre)
1370 lenconversions["meters"]=(lenconversions.metre)
1371 lenconversions["m"]=(lenconversions.metre)
1372 length["toMeters"]=(length.toMeters)
1373 wait()
1374 lenconversions["studs"]=(lenconversions.stud)
1375 wait()
1376 lenconversions["km"]=(lenconversions.kilometre)
1377 lenconversions["kilometres"]=(lenconversions.kilometre)
1378 lenconversions["kilometer"]=(lenconversions.kilometre)
1379 lenconversions["kilometers"]=(lenconversions.kilometre)
1380 length["toKilometers"]=(length.toKilometers)
1381 wait()
1382 lenconversions["inches"]=(lenconversions.inch)
1383 lenconversions["in"]=(lenconversions.inch)
1384 lenconversions[ [["]] ]=(lenconversions.inch)
1385 wait()
1386 lenconversions["feet"]=(lenconversions.foot)
1387 lenconversions["ft"]=(lenconversions.foot)
1388 lenconversions[ [[']] ]=(lenconversions.foot)
1389 wait()
1390 lenconversions["yards"]=(lenconversions.yard)
1391 lenconversions["yd"]=(lenconversions.yard)
1392 wait()
1393 lenconversions["miles"]=(lenconversions.mile)
1394 lenconversions["mi"]=(lenconversions.mile)
1395 wait()
1396 lenconversions["nautical mile"]=(lenconversions.nauticalmile)
1397 lenconversions["nm"]=(lenconversions.nauticalmile)
1398 lenconversions["nautical miles"]=(lenconversions.nauticalmile)
1399 lenconversions["nauticalmiles"]=(lenconversions.nauticalmile)
1400 end
1401 end,
1402
1403
1404 -- Conversion Functions
1405
1406 --[[
1407 HOW TO USE CONVERSION FUNCTIONS:
1408 (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")
1409 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
1410 --]]
1411 length = {
1412 conversions = {["millimetre"]=1,["centimetre"]=10,["stud"]=200,["decimetre"]=100,["metre"]=1000,["kilometre"]=1000*1000,["inch"]=25.4,["foot"]=304.8,["yard"]=914.4,["mile"]=1.609e+6,["nauticalmile"]=1.852e+6,},
1413 toMillimetres = function(ctype,num)
1414 local result = nil
1415 CVExtra.conversion.addTo()
1416 local conversions = CVExtra.conversion.length.conversions
1417 if type(num)=="number" then
1418 if type(ctype)=="string" then
1419 local bey = conversions[ctype:lower()]
1420 if bey then
1421 local numb = bey
1422 local mm = num*numb
1423 result = mm
1424 end
1425 end
1426 end
1427 return result
1428 end,
1429
1430 toCentimetres = function(ctype,num)
1431 local result = nil
1432 CVExtra.conversion.addTo()
1433 local conversions = CVExtra.conversion.length.conversions
1434 if type(num)=="number" then
1435 if type(ctype)=="string" then
1436 local bey = conversions[ctype:lower()]
1437 if bey then
1438 local numb = bey
1439 local mm = num*numb
1440 result = mm/conversions["centimetre"]
1441 end
1442 end
1443 end
1444 return result
1445 end,
1446
1447 toDecimetres = function(ctype,num)
1448 local result = nil
1449 CVExtra.conversion.addTo()
1450 local conversions = CVExtra.conversion.length.conversions
1451 if type(num)=="number" then
1452 if type(ctype)=="string" then
1453 local bey = conversions[ctype:lower()]
1454 if bey then
1455 local numb = bey
1456 local mm = num*numb
1457 result = mm/conversions["decimetre"]
1458 end
1459 end
1460 end
1461 return result
1462 end,
1463
1464 toStuds = function(ctype,num)
1465 local result = nil
1466 CVExtra.conversion.addTo()
1467 local conversions = CVExtra.conversion.length.conversions
1468 if type(num)=="number" then
1469 if type(ctype)=="string" then
1470 local bey = conversions[ctype:lower()]
1471 if bey then
1472 local numb = bey
1473 local mm = num*numb
1474 result = mm/conversions["stud"]
1475 end
1476 end
1477 end
1478 return result
1479 end,
1480
1481 toMetres = function(ctype,num)
1482 local result = nil
1483 CVExtra.conversion.addTo()
1484 local conversions = CVExtra.conversion.length.conversions
1485 if type(num)=="number" then
1486 if type(ctype)=="string" then
1487 local bey = conversions[ctype:lower()]
1488 if bey then
1489 local numb = bey
1490 local mm = num*numb
1491 result = mm/conversions["metre"]
1492 end
1493 end
1494 end
1495 return result
1496 end,
1497
1498 toKilometres = function(ctype,num)
1499 local result = nil
1500 CVExtra.conversion.addTo()
1501 local conversions = CVExtra.conversion.length.conversions
1502 if type(num)=="number" then
1503 if type(ctype)=="string" then
1504 local bey = conversions[ctype:lower()]
1505 if bey then
1506 local numb = bey
1507 local mm = num*numb
1508 result = mm/conversions["kilometre"]
1509 end
1510 end
1511 end
1512 return result
1513 end,
1514
1515 toInches = function(ctype,num)
1516 local result = nil
1517 CVExtra.conversion.addTo()
1518 local conversions = CVExtra.conversion.length.conversions
1519 if type(num)=="number" then
1520 if type(ctype)=="string" then
1521 local bey = conversions[ctype:lower()]
1522 if bey then
1523 local numb = bey
1524 local mm = num*numb
1525 result = mm/conversions["inch"]
1526 end
1527 end
1528 end
1529 return result
1530 end,
1531
1532 toFeet = function(ctype,num)
1533 local result = nil
1534 CVExtra.conversion.addTo()
1535 local conversions = CVExtra.conversion.length.conversions
1536 if type(num)=="number" then
1537 if type(ctype)=="string" then
1538 local bey = conversions[ctype:lower()]
1539 if bey then
1540 local numb = bey
1541 local mm = num*numb
1542 result = mm/conversions["foot"]
1543 end
1544 end
1545 end
1546 return result
1547 end,
1548
1549 toYards = function(ctype,num)
1550 local result = nil
1551 CVExtra.conversion.addTo()
1552 local conversions = CVExtra.conversion.length.conversions
1553 if type(num)=="number" then
1554 if type(ctype)=="string" then
1555 local bey = conversions[ctype:lower()]
1556 if bey then
1557 local numb = bey
1558 local mm = num*numb
1559 result = mm/conversions["yard"]
1560 end
1561 end
1562 end
1563 return result
1564 end,
1565
1566 toMiles = function(ctype,num)
1567 local result = nil
1568 CVExtra.conversion.addTo()
1569 local conversions = CVExtra.conversion.length.conversions
1570 if type(num)=="number" then
1571 if type(ctype)=="string" then
1572 local bey = conversions[ctype:lower()]
1573 if bey then
1574 local numb = bey
1575 local mm = num*numb
1576 result = mm/conversions["mile"]
1577 end
1578 end
1579 end
1580 return result
1581 end,
1582 toNauticalMiles = function(ctype,num)
1583 local result = nil
1584 CVExtra.conversion.addTo()
1585 local conversions = CVExtra.conversion.length.conversions
1586 if type(num)=="number" then
1587 if type(ctype)=="string" then
1588 local bey = conversions[ctype:lower()]
1589 if bey then
1590 local numb = bey
1591 local mm = num*numb
1592 result = mm/conversions["nauticalmile"]
1593 end
1594 end
1595 end
1596 return result
1597 end,
1598 Convert = function(otype,ctype,num) -- Type to convert to, Type to convert, Number of units
1599 local result = nil
1600 CVExtra.conversion.addTo()
1601 local conversions = CVExtra.conversion.length.conversions
1602 if type(num)=="number" then
1603 if type(otype)=="string" and type(ctype)=="string" then
1604 local bey = conversions[ctype:lower()]
1605 local sey = conversions[otype:lower()]
1606 if bey and sey then
1607 local numb = bey
1608 local mm = num*numb
1609 result = mm/sey
1610 end
1611 end
1612 end
1613 return result
1614 end,
1615 },
1616 liquid = {
1617 conversions = {["millilitre"]=1,["centilitre"]=10,["decilitre"]=100,["litre"]=1000},
1618 toMillilitres = function(ctype,num)
1619 local result = nil
1620 CVExtra.conversion.addTo()
1621 local conversions = CVExtra.conversion.liquid.conversions
1622 if type(num)=="number" then
1623 if type(ctype)=="string" then
1624 local bey = conversions[ctype:lower()]
1625 if bey then
1626 local numb = bey
1627 local ml = num*numb
1628 result = ml/conversions["millilitre"]
1629 end
1630 end
1631 end
1632 return result
1633 end,
1634 toCentilitres = function(ctype,num)
1635 local result = nil
1636 CVExtra.conversion.addTo()
1637 local conversions = CVExtra.conversion.liquid.conversions
1638 if type(num)=="number" then
1639 if type(ctype)=="string" then
1640 local bey = conversions[ctype:lower()]
1641 if bey then
1642 local numb = bey
1643 local ml = num*numb
1644 result = ml/conversions["centilitre"]
1645 end
1646 end
1647 end
1648 return result
1649 end,
1650 toDecilitres = function(ctype,num)
1651 local result = nil
1652 CVExtra.conversion.addTo()
1653 local conversions = CVExtra.conversion.liquid.conversions
1654 if type(num)=="number" then
1655 if type(ctype)=="string" then
1656 local bey = conversions[ctype:lower()]
1657 if bey then
1658 local numb = bey
1659 local ml = num*numb
1660 result = ml/conversions["decilitre"]
1661 end
1662 end
1663 end
1664 return result
1665 end,
1666 toLitres = function(ctype,num)
1667 local result = nil
1668 CVExtra.conversion.addTo()
1669 local conversions = CVExtra.conversion.liquid.conversions
1670 if type(num)=="number" then
1671 if type(ctype)=="string" then
1672 local bey = conversions[ctype:lower()]
1673 if bey then
1674 local numb = bey
1675 local ml = num*numb
1676 result = ml/conversions["litre"]
1677 end
1678 end
1679 end
1680 return result
1681 end,
1682 Convert = function(otype,ctype,num) -- Type to convert to, Type to convert, Number of units
1683 local result = nil
1684 CVExtra.conversion.addTo()
1685 local conversions = CVExtra.conversion.length.conversions
1686 if type(num)=="number" then
1687 if type(otype)=="string" and type(ctype)=="string" then
1688 local bey = conversions[ctype:lower()]
1689 local sey = conversions[otype:lower()]
1690 if bey and sey then
1691 local numb = bey
1692 local ml = num*numb
1693 result = ml/sey
1694 end
1695 end
1696 end
1697 return result
1698 end,
1699 },
1700 temp = {
1701 conversions = {["fahrenheit"]=1,["celsius"]=9/5+32,["kelvin"]=-273.15*9/5+32,},-32*5/9+273.15,
1702 toFahrenheit = function(ctype,num)
1703 local result = nil
1704 CVExtra.conversion.addTo()
1705 local conversions = CVExtra.conversion.temp.conversions
1706 if type(num)=="number" then
1707 if type(ctype)=="string" then
1708 local bey = conversions[ctype:lower()]
1709 if bey then
1710 local numb = bey
1711 local mm = num
1712 if ctype=="fahrenheit" then
1713
1714 else
1715 mm = numb*num/conversions["fahrenheit"]
1716 end
1717 if mm==0 then
1718 mm=numb
1719 end
1720 print(numb)
1721 print(num)
1722 print(mm)
1723 result = mm
1724 end
1725 end
1726 end
1727 return result
1728 end,
1729 },
1730 },
1731 checkLegitimateMatch = function(s,match,caseinsensitive)
1732 local result = nil
1733 local toChar = CVExtra.toCharList
1734 local getChar = CVExtra.getChar
1735 local function getmatch(str)
1736 local gmresult
1737 local nm = match -- newMatch
1738 if caseinsensitive == true then
1739 str = str:lower()
1740 nm=nm:lower()
1741 end
1742 local dm = toChar(match) -- doMatch
1743 local check = true
1744 for i,v in pairs(dm) do
1745 if v==getChar(str,i) then
1746 else
1747 check = false
1748 break
1749 end
1750 end
1751 if check==true then
1752 gmresult = str
1753 end
1754 return gmresult
1755 end
1756 local rtable = {}
1757 if type(match)=="string" then
1758 if type(s)=="string" then
1759 result = getmatch(s)
1760 elseif type(s)=="table" then
1761 for i,v in pairs(s) do
1762 if type(v)=="string" then
1763 local havematch = getmatch(v)
1764 if havematch then
1765 table.insert(rtable,havematch)
1766 end
1767 end
1768 end
1769 result = rtable
1770 end
1771 end
1772 return result
1773 end,
1774 GetPlayersFromString = function(s,caseinsensitive)
1775 local result = nil
1776 local name
1777 local playerlist = {}
1778 local players = game.Players
1779 local toChar = CVExtra.toCharList
1780 local getChar = CVExtra.getChar
1781 local function getPlayers(name)
1782 if caseinsensitive==true then
1783 name = name:lower()
1784 end
1785 for i,plr in pairs(players:GetPlayers()) do
1786 local pname = plr.Name
1787 if caseinsensitive==true then
1788 pname = pname:lower()
1789
1790 end
1791 local nChar = toChar(name)
1792 local check = true
1793 for i,v in pairs(nChar) do
1794 if v==getChar(pname,i) then
1795 else
1796 check = false
1797 break
1798 end
1799 end
1800 if check==true then
1801 table.insert(playerlist,plr)
1802 end
1803 end
1804 end
1805 if type(s) == "string" then
1806 name = s
1807 getPlayers(name)
1808 elseif typeof(s)=="Instance" then
1809 name = s.Name
1810 getPlayers(name)
1811 end
1812 result = playerlist
1813 return result
1814 end,
1815 removeLetter = function(s,it)
1816 local result = nil
1817 local toChar = CVExtra.toCharList
1818 local getChar = CVExtra.getChar
1819 local toString = CVExtra.charlistToString
1820 local function remove(ltrs)
1821 ltrs[it]=nil
1822 end
1823 if type(s)=="string" then
1824 local letters = toChar(s)
1825 if type(it)=="number" then
1826 if #letters>=it then
1827 remove(letters)
1828 end
1829 end
1830 local ns = toString(letters)
1831 result = ns
1832 end
1833 return result
1834 end,
1835 addLetter = function(s,addl,it)
1836 local result = nil
1837 local toChar = CVExtra.toCharList
1838 local getChar = CVExtra.getChar
1839 local toString = CVExtra.charlistToString
1840 local function add(ltrs)
1841 table.insert(ltrs,it,addl)
1842 end
1843 if type(s)=="string" and type(addl)=="string" then
1844 local letters = toChar(s)
1845 if type(it)=="number" then
1846 add(letters)
1847 end
1848 local ns = toString(letters)
1849 result = ns
1850 end
1851 return result
1852 end,
1853 replaceLetter = function(s,rpll,it)
1854 local result = nil
1855 local toChar = CVExtra.toCharList
1856 local getChar = CVExtra.getChar
1857 local toString = CVExtra.charlistToString
1858 local function replace(ltrs)
1859 local rpllchar = toChar(rpll)
1860 local i=it
1861 repeat
1862 ltrs[i]=nil
1863 i=i+1
1864 until ltrs[i]==nil or i>=#rpllchar
1865 local oi = i
1866 i=1
1867 repeat
1868 ltrs[it+i]=rpllchar[i]
1869 rpllchar[i]=nil
1870 i=i+1
1871 until i>oi
1872 if #rpllchar>0 then
1873 oi = #rpllchar
1874 i=1
1875 repeat
1876 table.insert(ltrs,rpllchar[i])
1877 rpllchar[i]=nil
1878 i=i+1
1879 until i>=oi
1880 end
1881 end
1882 if type(s)=="string" and type(rpll)=="string" then
1883 local letters = toChar(s)
1884 if it==nil then
1885 it=0
1886 end
1887 if type(it)=="number" then
1888 replace(letters)
1889 end
1890 local ns = toString(letters)
1891 result = ns
1892 end
1893 return result
1894 end,
1895 photomanipulation = {
1896 blacknwhite = function(rgb)
1897 local result = nil
1898 local desat = CVExtra.colours.desaturate
1899 result = desat(rgb,100)
1900 return result
1901 end,
1902 sepia = function(rgb)
1903 local result = nil
1904 if typeof(rgb)=="Color3" then
1905 local HSVt = {0,0,0}
1906 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
1907 HSVt[1] = 30/359
1908 if HSVt[2]<10/255 then
1909 HSVt[2]=HSVt[2]+(10/255)
1910 end
1911 if HSVt[2]>230/255 then
1912 HSVt[2]=230/255
1913 end
1914 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
1915 result = HSV
1916 end
1917 return result
1918 end,
1919 cyanotype = function(rgb)
1920 local result = nil
1921 if typeof(rgb)=="Color3" then
1922 local HSVt = {0,0,0}
1923 HSVt[1],HSVt[2],HSVt[3]=Color3.toHSV(rgb)
1924 HSVt[1] = 195/359
1925 if HSVt[2]<25/255 then
1926 HSVt[2]=HSVt[2]+(25/255)
1927 end
1928 if HSVt[2]>250/255 then
1929 HSVt[2]=250/255
1930 end
1931 local HSV = Color3.fromHSV(HSVt[1],HSVt[2],HSVt[3])
1932 result = HSV
1933 end
1934 return result
1935 end,
1936 photomlist =
1937 {"blacknwhite","bw","blackandwhite","black&white",
1938 "sepia",
1939 "cyanotype",},
1940
1941 world = function(s)
1942 local photomlist = CVExtra.photomanipulation.photomlist
1943 local function match()
1944 local result = nil
1945 for i,v in pairs(photomlist) do
1946 if s:lower()==v then
1947 if i>0 and i<=4 then
1948 result = 1
1949 break
1950 elseif i==5 then
1951 result = 2
1952 break
1953 elseif i==6 then
1954 result = 3
1955 break
1956 end
1957 end
1958 end
1959 return result
1960 end
1961 local function doworld(md)
1962 local places = {game.Workspace,game.StarterGui,game.StarterPack,game.Players}
1963 local Type = nil
1964 local GetAll = CVExtra.GetAllChildren
1965 if md==1 then
1966 Type="blacknwhite"
1967 elseif md==2 then
1968 Type="sepia"
1969 elseif md==3 then
1970 Type="cyanotype"
1971 end
1972 local colour = CVExtra.photomanipulation[Type]
1973 for i,place in pairs(places) do
1974 local placestuff = GetAll(place,true)
1975 for a,stuff in pairs(placestuff) do
1976 if stuff:IsA("BasePart") or stuff:IsA("Light") then
1977 stuff.Color = colour(stuff.Color)
1978 elseif stuff:IsA("GuiObject") then
1979 stuff.BackgroundColor3 = colour(stuff.BackgroundColor3)
1980 stuff.BorderColor3 = colour(stuff.BorderColor3)
1981 if stuff:IsA("TextBox") or stuff:IsA("TextLabel") or stuff:IsA("TextButton") then
1982 stuff.TextColor3 = colour(stuff.TextColor3)
1983 stuff.TextStrokeColor3 = colour(stuff.TextStrokeColor3)
1984 elseif stuff:IsA("ImageLabel") or stuff:IsA("ImageButton") then
1985 stuff.ImageColor3 = colour(stuff.ImageColor3)
1986 elseif stuff:IsA("BodyColors") then
1987 stuff.HeadColor3 = colour(stuff.HeadColor3)
1988 stuff.TorsoColor3 = colour(stuff.TorsoColor3)
1989 stuff.LeftArmColor3 = colour(stuff.LeftArmColor3)
1990 stuff.RightArmColor3 = colour(stuff.RightArmColor3)
1991 stuff.LeftLegColor3 = colour(stuff.LeftLegColor3)
1992 stuff.RightLegColor3 = colour(stuff.RightLegColor3)
1993 end
1994 else
1995 end
1996 end
1997 wait()
1998 end
1999 end
2000 if type(s)=="string" then
2001 local matched = match(s)
2002 if matched==nil then
2003
2004 else
2005 doworld(matched)
2006 end
2007 end
2008 end,
2009 vision = function(s)
2010 local photomlist = CVExtra.photomanipulation.photomlist
2011 local function match()
2012 local result = nil
2013 for i,v in pairs(photomlist) do
2014 if s:lower()==v then
2015 if i>0 and i<=4 then
2016 result = 1
2017 break
2018 elseif i==5 then
2019 result = 2
2020 break
2021 elseif i==6 then
2022 result = 3
2023 break
2024 end
2025 end
2026 end
2027 return result
2028 end
2029 local function dovision(md)
2030 local Type = nil
2031 local Lighting = game:GetService("Lighting")
2032 if md==1 then
2033 Type="blacknwhite"
2034 elseif md==2 then
2035 Type="sepia"
2036 elseif md==3 then
2037 Type="cyanotype"
2038 end
2039 local colourfunc = CVExtra.photomanipulation[Type]
2040 local function color(rgb)
2041 local colorc
2042 local light = Lighting:GetChildren()
2043 for i,v in pairs(light) do
2044 if v.Name=="Vision" then
2045 v.Parent=nil
2046 end
2047 end
2048 colorc = Instance.new("ColorCorrectionEffect")
2049 colorc.Name = "Vision"
2050 colorc.Saturation = -1
2051 colorc.TintColor = rgb
2052 return colorc
2053 end
2054 local basecolour = Color3.fromRGB(255,100,100)
2055 local colour = colourfunc(basecolour)
2056 local coloreffect = color(colour)
2057 coloreffect.Parent = Lighting
2058 end
2059 local mode = match()
2060 dovision(mode)
2061 end,
2062 },
2063 dropHats = function(plr)
2064 local result
2065 local hats = {}
2066 local getPlayer = CVExtra.getPlayer
2067 local function drophats()
2068 local char
2069 if plr:IsA("Player") then
2070 char = plr.Character
2071 elseif plr:IsA("Model") then
2072 char = plr
2073 end
2074 for i,hat in pairs(char:GetChildren()) do
2075 if hat:IsA("Accessory") or hat:IsA("Hat") then
2076 table.insert(hats,hat)
2077 hat.Parent = workspace
2078 end
2079 end
2080 result = hats
2081 end
2082 if type(plr)=="string" then
2083 local newplr = getPlayer(plr)
2084 if newplr == nil then
2085
2086 else
2087 plr = newplr
2088 drophats()
2089 end
2090 elseif typeof(plr)=="Instance" then
2091 if plr:IsA("Model") or plr:IsA("Player") then
2092 drophats()
2093 end
2094 end
2095 return hats
2096 end,
2097 getVector3Area = function(object,range,shape) -- WIP
2098 local reg3
2099 local objvec
2100 local ago = true
2101 if typeof(object)=="Instance" then
2102 if object:IsA("BasePart") then
2103 objvec = Vector3.new(object.Position)
2104 elseif typeof(object)=="Vector3" then
2105 objvec = object
2106 else
2107 ago = false
2108 end
2109 else
2110 ago = false
2111 end
2112 print(range)
2113 if type(range)=="number" then
2114 range = range/4
2115 else
2116 ago = false
2117 end
2118 if type(shape)=="string" then
2119 if shape:lower()=="sphere" then
2120 else
2121 shape = "cube"
2122 end
2123 else
2124 shape = "cube"
2125 end
2126 print(shape)
2127 print(ago)
2128 if ago==true then
2129 local ranvec = Vector3.new(range,range,range)
2130 reg3 = Region3.new(objvec-ranvec,objvec+ranvec)
2131 end
2132 return reg3
2133 end,
2134 getAncestry = function(instance)
2135 local result
2136 local ancestryStr = {}
2137 local ancestry = {}
2138 local toChar = CVExtra.toCharList
2139 local toString = CVExtra.charlistToString
2140 local name = ""
2141 local function getObjFromString(str)
2142 for i,s in pairs(str) do
2143 if s=="." then
2144 table.insert(ancestryStr,name)
2145 name = ""
2146 else
2147 name = name..s
2148 end
2149 end
2150 return ancestryStr
2151 end
2152 if typeof(instance)=="Instance" then
2153 local stringAncestry = instance:GetFullName()
2154 local nstring = toChar(stringAncestry)
2155 local stringlist = getObjFromString(nstring)
2156 for i,v in pairs(stringlist) do
2157 if i==1 then
2158 if game:FindFirstChild(v)==nil then
2159 else
2160 table.insert(ancestry,game:FindFirstChild(v))
2161 end
2162 else
2163 if ancestry[i-1]:FindFirstChild(v)==nil then
2164 else
2165 table.insert(ancestry,ancestry[i-1]:FindFirstChild(v))
2166 end
2167 end
2168 end
2169 result = ancestry
2170 end
2171 return result
2172 end,
2173 getCommands = function() -- WIP
2174 local result
2175 local functions
2176 functions = {}
2177 print(functions)
2178 local toChar = CVExtra.toCharList
2179 local toString = CVExtra.charlistToString
2180 local function searchTable(tab,nam)
2181 local parent = ""
2182 for i,v in pairs(tab) do
2183 if tab==nil or nam==nil or tostring(tab)==CVExtra then
2184 parent=""
2185 else
2186 local nam2 = toChar(nam)
2187 nam = toString(nam2)
2188 print(nam)
2189 print(nam2)
2190 parent=""..nam
2191 end
2192 if typeof(v)=="function" then
2193 print("function")
2194 local funcr = ""..tostring(i)
2195 local func = toChar(funcr)
2196 funcr = toString(func)
2197 func = funcr
2198 if parent=="" then
2199
2200 else
2201 func = parent.."."..funcr
2202 end
2203 table.insert(functions,func)
2204 elseif typeof(v)=="table" then
2205 print("table")
2206 searchTable(v,tostring(i))
2207 end
2208 end
2209 return tab
2210 end
2211 result = searchTable(CVExtra)
2212 return result
2213 end,
2214 limitedTable = function(len,name)
2215 local result
2216 len = tonumber(len)
2217 local t = {}
2218 local tablename
2219 -- REQUIRED FUNCTIONS
2220 local mathrandom = CVExtra.mathrandom
2221 --
2222 local metatable = {}
2223 if type(name)=="string" then
2224 tablename = name
2225 else
2226 tablename = tostring(metatable)
2227 end
2228 if len~=nil then
2229 if len<0 then
2230 len=0
2231 end
2232 metatable = {
2233 lengthmax = len,
2234 __newindex = function(self,iter,val)
2235 if val==nil then
2236 else
2237 if (#self+1>len) then
2238 rawset(self, iter, nil)
2239 warn(tablename..": cannot add in another element -- max "..len);
2240 else
2241 rawset(self,iter,val)
2242 end
2243 end
2244 end,
2245 spawn(function()
2246 local self = t
2247 local db = false
2248 repeat
2249 if #self>len then
2250 if db==false then
2251 db = true
2252 warn(tablename..": ".."cannot have more than "..len.." element(s) in a table!")
2253 for i,v in pairs(self) do
2254 if i>len then
2255 self[i]=nil
2256 end
2257 end
2258 if len<1 then
2259 self[1]=nil
2260 end
2261 db=false
2262 end
2263 end
2264 wait(mathrandom(0.1,1.5))
2265 until 1==0
2266 end),
2267 getLength = function()
2268 local self = t
2269 local length = self.lengthmax
2270 return length
2271 end,
2272 }
2273
2274 t = setmetatable(t,metatable)
2275 result = t
2276 end
2277 return result
2278 end,
2279}
2280return CVExtra