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: Help Appreciated!

Previous Thread :: Next Thread 
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
12 Jan 2013 04:29 PM
Hi,

I have a script which makes a model fade out and then fade in when i press the button again. The fade out is fine but when i fade it back instead of the transparency going from 1 to 0 it goes 1 to 3.502e-009 however each function has for i=1,10 so that should happen. For some reason for i=1,10 doesn't work or at least i don't think it does so i put in a repeat to change the transparency as well just in case and the repeat stops working when a=10 but the transparency just goes over 0 to 3.502e-009

I can paste the script if needs be.
Thanks!
Report Abuse
itunes89 is not online. itunes89
Joined: 19 Jan 2011
Total Posts: 1957
12 Jan 2013 04:36 PM
Yea, can you post the script?
Report Abuse
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
12 Jan 2013 04:36 PM
local main = script.Parent.Parent.Parent.Parent.Parent.Parent
local full = main.Parent
local entry = full.Entry
local fuse = main.Fused
local Cloaked = main.Cloaked

function Cloakoff()
if (fuse.Value == true) then return end
if (Cloaked.Value == true) then
local cloak = Cloaked.Value
main.Parts.ConsolePlat.Console.CenterThing.Uncloak:Play()
entry.Base.Uncloak:Play()
for i=1, 10 do
local amount = ({[true] = -0.1/10,[false] = 0.1/10})[cloak]
recursiveTransparency(entry,amount)
wait(0.02)
end
Cloaked.Value = false
end
end
script.Parent.ClickDetector.MouseClick:connect(Cloakoff)

function Cloakon()
if (fuse.Value == true) then return end
if (Cloaked.Value == false) then
local cloak = Cloaked.Value
main.Parts.ConsolePlat.Console.CenterThing.Cloak:Play()
entry.Base.Cloak:Play()
for i=1, 10 do
local amount = ({[true] = -0.1/10,[false] = 0.1/10})[cloak]
recursiveTransparency(entry,amount)
wait(0.02)
end
Cloaked.Value = true
end
end
script.Parent.ClickDetector.MouseClick:connect(Cloakon)

function recursiveTransparency(parent,trans)
if (parent == nil) then return end
trans = trans or 0

for k,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
a=0
repeat
v.Transparency = v.Transparency+trans
a=a+1
until (a==10) end
if (#v:GetChildren() > 0) then
recursiveTransparency(model,trans)
end
end
end
Report Abuse
itunes89 is not online. itunes89
Joined: 19 Jan 2011
Total Posts: 1957
12 Jan 2013 04:42 PM
It's hard to find a problem in this because it's so long. Print out the value as it changes and see where it goes wrong. That's really all I can say.
Report Abuse
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
12 Jan 2013 04:44 PM
It's not rather it doesn't work. It just works to much. Like i said instead of going 1 to 0 it goes 1 to 3.52 + e or whatever... I just cut out the relevant parts...
Report Abuse
itunes89 is not online. itunes89
Joined: 19 Jan 2011
Total Posts: 1957
12 Jan 2013 04:45 PM
Just do what I said. You'll find the problem.
Report Abuse
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
12 Jan 2013 04:45 PM

for i=1, 10 do
local amount = ({[true] = -0.1/10,[false] = 0.1/10})[cloak]
recursiveTransparency(entry,amount)



for i=1, 10 do
local amount = ({[true] = -0.1/10,[false] = 0.1/10})[cloak]
recursiveTransparency(entry,amount)



for k,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
a=0
repeat
v.Transparency = v.Transparency+trans
a=a+1
until (a==10) end
Report Abuse
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
12 Jan 2013 04:50 PM
It doesn't make an error! It just doesn't do what it should do. Fadeout the transparency goes from 0 to 1 which is good. That's what it should do.
But when fading back in it goes from 1 to 3.52+e which it shouldn't and i can't find anything in the script that makes it go from 1 to 3.52+e when it should go from 1 to 0
Report Abuse
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
12 Jan 2013 04:56 PM
bump
Report Abuse
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
12 Jan 2013 05:07 PM
bump. Please Help!
Report Abuse
TheDoctor4816 is not online. TheDoctor4816
Joined: 08 Feb 2009
Total Posts: 396
14 Jan 2013 02:53 PM
Bump :)
Report Abuse
Saltless is not online. Saltless
Joined: 24 Dec 2012
Total Posts: 107
14 Jan 2013 02:58 PM
Transparency isn't 1-10, it's 0-1

Change "for i = 1, 10 do" to "for i = 0, 1, .1 do"

-- A fry without salt is like a world without hate.
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