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: Fade out

Previous Thread :: Next Thread 
grilledcheese131 is not online. grilledcheese131
Joined: 27 Feb 2010
Total Posts: 236
01 Feb 2014 03:48 PM
I have this script so that when someone touches the part it gives them money. The part then has to fade out. The "give money" part works fine but the fade out doesn't work at all. The object still gets destroyed but there isn't a fade. Here is the script:

local ting = 0 --debouncer

function onTouched(hit)

if ting == 0 then --debounce check
ting = 1 --activate debounce
check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button

if check ~= nil then --If a human is found, then

local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder

if stats ~= nil then --If moneyholder exists then
local cash = stats:findFirstChild("Money") --Get money
cash.Value = cash.Value +200 --increase amount of money by the number displayed here (500)
wait(1) --wait-time before button works again
script.Parent.Transparency = 0.4 --Fade Part 1
script.Parent.Transparency = 0.8 --Fade Part 2
script.Parent:Destroy() --Fade Part 3 (Destroy)
end

end

ting = 0 --remove debounce
end
end

script.Parent.Touched:connect(onTouched)


Any help would be appreciated.
Thanks,
Grilled
Report Abuse
grilledcheese131 is not online. grilledcheese131
Joined: 27 Feb 2010
Total Posts: 236
01 Feb 2014 04:25 PM
bump?
Report Abuse
Scavagious is not online. Scavagious
Joined: 13 Jun 2013
Total Posts: 83
01 Feb 2014 04:26 PM
You need to use wait() between each of the parts at which it changes Transparency.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
01 Feb 2014 04:27 PM
Please just trim it down to the error in the script. It gets you replies much faster.

script.Parent.Transparency = 0.4 --Fade Part 1
script.Parent.Transparency = 0.8 --Fade Part 2
script.Parent:Destroy() --Fade Part 3 (Destroy)

You have no waits, so the fade is faster than you can see it.
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
01 Feb 2014 04:31 PM
Since that looks really choppy and the answer has been given to you, here's a generic loop that'll make the fade look very smooth.

for i = 1,20 do
script.Parent.Transparency = script.Parent.Transparency + 0.05
wait()
end
script.Parent:Destroy()

You just replace this area:

"script.Parent.Transparency = 0.4 --Fade Part 1
script.Parent.Transparency = 0.8 --Fade Part 2
script.Parent:Destroy() --Fade Part 3 (Destroy)"

With what I gave you.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
01 Feb 2014 04:35 PM
Yeah, go with rose. That is smoother.
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