Module is done!
Model: http://www.roblox.com/TextPlus-Module-item?id=276261457
Code:
--[[TextPlus module by FromLegoUniverse (base math by Zacattack)
FUNCTIONS:
Module:ApplyEffects(Instance TextLabel,Bool ShadowsEnabled,Bool BevelEnabled,Float Angle,TableOrNil Overrides)
Instance TextLabel: Instance of the text label to add effects
Bool ShadowsEnabled: If true, adds shadows
Bool BevelEnabled: If true, adds a glow/bevel
Float Angle: The number (in degrees) of how light effects the bevel and shadows (should be 0 to 360)
TableOrNil Overrides: See below
Module:RemoveEffects(Instance TextLabel,Bool PreserveShadow,Bool PreserveBevel)
Instance TextLabel: Instance of the text label to remove effects
Bool PreserveShadow: If true, it will keep shadow effects if any
Bool PreserveBevel: If true, it will keep the bevel effects if any
ABOUT OVERRIDES:
Overrides is an optional table for ApplyEffects, that gives overrides to the settings below.
The table would be formatted like so:
{Mode = "Direct",ShadowColor = Color3.new(1,1,1),ShadowDistance = 4},
or Property = Override property
Here is what each does:
Cartoonify: 0 is normal fade, 1 is hard shadows, and 2 is hard and thick shadows
Mode: Weak is a weak shadow, Strong is a medium shadow, Direct is a strong shadow,
and Center is a full shadow around
ShadowColor: Color of the Shadow
ShadowTransparency: Transparency of the shadow (if Cartoonify is 0)
ShadowDistance: How far away the shadow is from the text
TextStrokeTransparency: Stroke of the shadow if Cartoonify is 0 or 1
BevelGlowColor: Color of the glow of the bevel
BevelGlowTransparency: Transparency of the glow of the bevel
BevelShadowColor: Color of the shadow of the bevel
BevelShadowTransparency: Transparency of the shadow of the bevel
BevelDistance: Distance of the bevel from the text
--]]
local Cartoonify = 0
local Mode = "Weak" --Weak, Strong, Direct, Center
local ShadowColor = Color3.new(0,0,0)
local ShadowTransparency = 0.92
local ShadowDistance = 4
local TextStrokeTransparency = 0.5
local BevelGlowColor = Color3.new(1,1,1)
local BevelGlowTransparency = 0.92
local BevelShadowColor = Color3.new(0,0,0)
local BevelShadowTransparency = 0.95
local BevelDistance = 2
local sin,rad,cos = math.sin,math.rad,math.cos
local Module = {}
function Module:ApplyEffects(Label,ShadowsEnabled,BevelEnabled,EffectAngle,Overrides)
if not Label then error("Unable to apply effects, not label given") end
if not EffectAngle then warn("No Angle given, using 0 degrees") EffectAngle = 0 end
Overrides = Overrides or {}
local Cartoonify = Overrides.Cartoonify or Cartoonify
local Mode = Overrides.Mode or Mode
local ShadowColor = Overrides.ShadowColor or ShadowColor
local ShadowTransparency = Overrides.ShadowTransparency or ShadowTransparency
local ShadowDistance = Overrides.ShadowDistance or ShadowDistance
local TextStrokeTransparency = Overrides.TextStrokeTransparency or TextStrokeTransparency
local BevelGlowColor = Overrides.BevelGlowColor or BevelGlowColor
local BevelGlowTransparency = Overrides.BevelGlowTransparency or BevelGlowTransparency
local BevelShadowColor = Overrides.BevelShadowColor or BevelShadowColor
local BevelShadowTransparency = Overrides.BevelShadowTransparency or BevelShadowTransparency
local BevelDistance = Overrides.BevelDistance or BevelDistance
if Label:FindFirstChild("Shadow") then Label:FindFirstChild("Shadow"):Destroy() end
if Label:FindFirstChild("Shadow2") then Label:FindFirstChild("Shadow2"):Destroy() end
if Label:FindFirstChild("Shadow3") then Label:FindFirstChild("Shadow3"):Destroy() end
if Label:FindFirstChild("Shadow4") then Label:FindFirstChild("Shadow4"):Destroy() end
if Label:FindFirstChild("BevelGlow") then Label:FindFirstChild("BevelGlow"):Destroy() end
if Label:FindFirstChild("BevelShadow") then Label:FindFirstChild("BevelShadow"):Destroy() end
if Label.ZIndex < 2 then
Label.ZIndex = 2
elseif Label.ZIndex > 9 then
Label.ZIndex = 9
end
local t_zindex = Label.ZIndex
if ShadowsEnabled == true then
local s = Label:Clone()
s.Parent = Label
s.ZIndex = t_zindex - 1
s.Name = "Shadow"
s.TextColor3 = ShadowColor
s.Size = UDim2.new(1,0,1,0)
s.TextStrokeColor3 = ShadowColor
s.TextTransparency = ShadowTransparency
s.TextStrokeTransparency = ShadowTransparency
s.BackgroundTransparency = 1
if Cartoonify == 1 then
s.TextTransparency = 0
s.TextStrokeTransparency = 1
elseif Cartoonify == 2 then
s.TextTransparency = 0
s.TextStrokeTransparency = 0
end
if Mode == "Weak" then
local RAngle = rad(EffectAngle + 180)
local X,Y = cos(RAngle)*ShadowDistance,-sin(RAngle)*ShadowDistance
s.Position = UDim2.new(0,X,0,Y)
elseif Mode == "Strong" then
local s2 = s:Clone()
s2.Name = "Shadow2"
s2.Parent = Label
local RAngle = rad(EffectAngle + 180 + 45)
local X,Y = cos(RAngle)*ShadowDistance,-sin(RAngle)*ShadowDistance
s.Position = UDim2.new(0,X,0,Y)
local RAngle = rad(EffectAngle + 180 - 45)
local X,Y = cos(RAngle)*ShadowDistance,-sin(RAngle)*ShadowDistance
s2.Position = UDim2.new(0,X,0,Y)
elseif Mode == "Direct" then
local s2 = s:Clone()
s2.Name = "Shadow2"
s2.Parent = Label
local s3 = s:Clone()
s3.Name = "Shadow3"
s3.Parent = Label
local RAngle = rad(EffectAngle + 180)
local X,Y = cos(RAngle)*ShadowDistance,-sin(RAngle)*ShadowDistance
s.Position = UDim2.new(0,X,0,Y)
local RAngle = rad(EffectAngle + 180 + 125)
local X,Y = cos(RAngle)*ShadowDistance/2,-sin(RAngle)*ShadowDistance/2
s2.Position = UDim2.new(0,X,0,Y)
local RAngle = rad(EffectAngle + 180 - 125)
local X,Y = cos(RAngle)*ShadowDistance/2,-sin(RAngle)*ShadowDistance/2
s3.Position = UDim2.new(0,X,0,Y)
elseif Mode == "Center" then
local s2 = s:Clone()
s2.Name = "Shadow2"
s2.Parent = Label
local s3 = s:Clone()
s3.Name = "Shadow3"
s3.Parent = Label
local s4 = s:Clone()
s4.Name = "Shadow4"
s4.Parent = Label
local RAngle = rad(45)
local X,Y = cos(RAngle)*ShadowDistance,-sin(RAngle)*ShadowDistance
s.Position = UDim2.new(0,X,0,Y)
s2.Position = UDim2.new(0,X,0,-Y)
s3.Position = UDim2.new(0,-X,0,Y)
s4.Position = UDim2.new(0,-X,0,-Y)
end
end
if BevelEnabled == true then
local b = Label:Clone()
b.Parent = Label
b.Name = "BevelGlow"
b.ZIndex = t_zindex + 1
b:ClearAllChildren()
b.TextColor3 = BevelGlowColor
b.Size = UDim2.new(1,0,1,0)
b.TextStrokeColor3 = BevelGlowColor
b.TextTransparency = BevelGlowTransparency
b.TextStrokeTransparency = BevelGlowTransparency
b.BackgroundTransparency = 1
local b2 = b:Clone()
b2.Parent = Label
b2.Name = "BevelShadow"
b2:ClearAllChildren()
b2.TextColor3 = BevelShadowColor
b2.Size = UDim2.new(1,0,1,0)
b2.TextStrokeColor3 = BevelShadowColor
b2.TextTransparency = BevelShadowTransparency
b2.TextStrokeTransparency = BevelShadowTransparency
b2.BackgroundTransparency = 1
local RAngle = rad(EffectAngle)
local X,Y = cos(RAngle)*BevelDistance,-sin(RAngle)*BevelDistance
b.Position = UDim2.new(0,X,0,Y)
b2.Position = UDim2.new(0,-X,0,-Y)
end
end
function Module:RemoveEffects(Label,Shadow,Bevel)
if not Label then error("Unable to remove effects, not label given") end
if Shadow ~= true then
local Shadow,Shadow2,Shadow3,Shadow4 = Label:FindFirstChild("Shadow"),Label:FindFirstChild("Shadow2"),Label:FindFirstChild("Shadow3"),Label:FindFirstChild("Shadow4")
if Shadow then Shadow:Destroy() end
if Shadow2 then Shadow2:Destroy() end
if Shadow3 then Shadow3:Destroy() end
if Shadow4 then Shadow4:Destroy() end
end
if Bevel ~= true then
local Glow,Shadow = Label:FindFirstChild("BevelGlow"),Label:FindFirstChild("BevelShadow")
if Glow then Glow:Destroy() end
if Shadow then Shadow:Destroy() end
end
end
Module:ApplyEffects(game.StarterGui.ScreenGui.TextLabel,true,true,120)
return Module