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 » Scripting Helpers
Home Search
 

Re: -

Previous Thread :: Next Thread 
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 01:20 PM
p = 0
while wait(.3) do
p = script.Parent.Transparency
if
p == 1 then
script.Parent.Transparency = p - .1
else
script.Parent.Transparency = p + .1
end
end
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 01:24 PM
I have seen that there is a slight fluxuation in preciseness for Transparency. Try:

if math.abs(p-1) <= .05 then

instead of:

if p == 1 then
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 01:27 PM
that just flashes now
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 01:31 PM
try lowering .05 to maybe .02?
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 01:32 PM
still flashes
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 01:33 PM
Oh wait! I didn't notice that you defined the variable 'p' once! It doesn't automatically update with the transparency. It will remain the same.
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 01:35 PM
i defined it twice
p = 0
while wait(.3) do
p = script.Parent.Transparency
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 01:37 PM
Oh sorry. That was a rush on my part. If it is in the loop, it should be fine.
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 01:39 PM
Yeah, it will keep oscillating between 0.9 and 1 because whenever it ISN'T 1 it will increase and whenever it IS 1 it will decrease.
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 01:40 PM
o
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 01:47 PM
any way to fix...?
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 01:50 PM
Do you want it to change from 0 to 1 and back to 0 repeatedly?
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 01:52 PM
yes
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 02:01 PM
x = 1
while wait(.3) do
x = x+.1
script.Parent.Transparency = math.abs(math.asin(math.cos(x*5/math.pi)))*2/math.pi
end
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 02:07 PM
no not like that
i want it to go though each .1
.1 .2 .3 .4 .5 .6 .7 .8 .9
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 02:11 PM
Did you even try it?
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 02:13 PM
yes
it just does
1
0
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 02:26 PM
Agh, there is some truncation error in that function. Just use this:

x = 1
while wait(.3) do
if script.Parent.Transparency >= .98 then x = -1
elseif script.Parent.Transparency <= .02 then x = 1 end
script.Parent.Transparency = script.Parent.Transparency+.1*x
end
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
11 Aug 2013 02:28 PM
thanks
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
11 Aug 2013 02:47 PM
efficient way :


local x = script.Parent
local a = 1

while wait(.3) do
for i = 1, 10 do
x.Transparency = x.Transparency + .1*a
wait(.3)
end
a = -a
end
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
11 Aug 2013 02:49 PM
bunnyboy
x = 1
while wait(.3) do
x = x+.1
script.Parent.Transparency = math.abs(math.asin(math.cos(x*5/math.pi)))*2/math.pi
end

this makes no sense at all
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
11 Aug 2013 02:51 PM
super super efficient way :

local x = script.Parent
local a = 1

while wait(.3) do
x.Transparency = x.Transparency + .1 * ((math.floor(x.Transparency + .5)*2)-1)
end
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 10:15 PM
@FreeToTake

Before making assumptions, try Googling:

Graph for abs(asin(cos(x*5/pi)))*2/pi

And hopefully you'll see what I am getting at.
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
11 Aug 2013 10:17 PM
I don't see how that second script of yours is even supposed to work.
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
12 Aug 2013 11:06 AM
i just don't see of what use trigonometry functions are in this situation
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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