generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Easier way?

Previous Thread :: Next Thread 
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
19 Oct 2015 08:20 PM
Is there an easier way to code the transparency parts? It seems so inefficient and ugly.
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
local gui = Instance.new("ScreenGui", p.PlayerGui)
local frame = Instance.new("Frame", gui)
frame.Size = UDim2.new(1,0,1,0)
frame.BackgroundColor = BrickColor.new("Really black")
local label = Instance.new('TextLabel', frame)
label.Size = UDim2.new(1,frame.AbsoluteSize/2,1,frame.AbsoluteSize/2)
label.BackgroundTransparency = 1
label.FontSize = 'Size36'
label.TextColor3 = Color3.new(255,255,255)
label.Text = 'Are you awake?'
wait(1.3)
for i = 1,10 do
label.TextTransparency = label.TextTransparency + .1 -- MAKE IT INVISIBLE
wait(.1)
end
label.Text = 'Okay, good. I am NiL.'
for i = 1,10 do
label.TextTransparency = label.TextTransparency - .1 -- MAKE IT VISIBLE
wait(.1)
end
for i = 1,10 do
label.TextTransparency = label.TextTransparency + .1 -- INVISIBLE
wait(.1)
end
label.Text = 'This, this game.'
for i = 1,10 do
label.TextTransparency = label.TextTransparency - .1 -- VISIBLE
wait(.1)
end
for i = 1,10 do
label.TextTransparency = label.TextTransparency + .1 -- INVISIBLE
wait(.1)
end
label.Text = 'Is your adventure.'
for i = 1,10 do
label.TextTransparency = label.TextTransparency - .1
wait(.1)
end
local button = Instance.new('TextButton', frame)
button:TweenPosition(UDim2.new(0,0,.8,0), 'Out', 'Quad', .7, false)
button.Size = UDim2.new(1,50,.06,50)
button.Text = 'Play'
button.BackgroundTransparency = .3
button.FontSize = 'Size36'
button.MouseButton1Down:connect(function()
print('Clicked')
wait(.2)
gui:remove()
end)
while wait(.5) do
button.BackgroundColor = BrickColor.Random()
end
end)
end)


F3X Moderator / GFX Designer / Coder / Clothing Designer
Report Abuse
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
19 Oct 2015 08:33 PM
Bump



F3X Moderator / GFX Designer / Coder / Clothing Designer
Report Abuse
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
20 Oct 2015 08:51 AM
Bump
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
20 Oct 2015 08:53 AM
You could put each statement inside a table and than the for loops for transparency could be part of a for loop through each table index
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
20 Oct 2015 08:56 AM
function ShowLabel(state, label)
for i = 1,10 do
label.TextTransparency = label.TextTransparency + state*.1
wait(.1)
end
end

ShowLabel(1, label)
label.Text = 'Okay, good. I am NiL.'
LabelEffect(-1, label)
LabelEffect(1, label)
label.Text = 'This, this game.'
LabelEffect(-1, label)
LabelEffect(1, label)
label.Text = 'Is your adventure.'
LabelEffect(-1, label)
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
20 Oct 2015 08:57 AM
*oops;

ShowLabel(1, label)
label.Text = 'Okay, good. I am NiL.'
ShowLabel(-1, label)
ShowLabel(1, label)
label.Text = 'This, this game.'
ShowLabel(-1, label)
ShowLabel(1, label)
label.Text = 'Is your adventure.'
ShowLabel(-1, label)
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
20 Oct 2015 09:02 AM
or you could just put them both into one function


function ShowLabel(label)
for i = 0,1, 0.05 do
label.TextTransparency = label.TextTransparency + (i <= .5 and i*2 or 1-i*2)
wait(.1)
end
label.Text = 'Are you awake?'
end
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
20 Oct 2015 09:04 AM
err, this

function ShowLabel(label, text)
for i = 0,2,0.1 do
label.TextTransparency = label.TextTransparency + (i <= 1 and i or 2-i)
wait(.1)
end
label.Text = text
end
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
20 Oct 2015 09:04 AM
The first time he loops it it only goes visible
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
20 Oct 2015 09:09 AM
then slap it all into one function
give the function a parameter that determines how many times you want it to loop or something

there are a lot of ways to go about this, i'm just too lazy to put it into context
Report Abuse
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
20 Oct 2015 03:29 PM
I'm still a noob scripter. q.q



F3X Moderator / GFX Designer / Coder / Clothing Designer
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image