|
| 20 Mar 2016 01:09 PM |
So what I'm trying to do is make this script have a fading in and fading out effect
I'm most likely going to do this by use Volume=0.1 Volume=0.2 (exc) and then go back down for the fade out
Here's the script that that i use---------------------------
local this = {}
local musicNow = script.song.Value local songPitch = 1 local songVolume = 1 local player = script.Parent.Parent
function this.Setup() if player:findFirstChild("SongPlayerData")==nil then local b = Instance.new("BoolValue") b.Name = "SongPlayerData" b.Parent = player local o = Instance.new("StringValue") o.Name = "SongPlay" o.Parent = b local v = Instance.new("NumberValue") v.Name = "Volume" v.Value = songVolume v.Parent = b else songVolume = player.SongPlayerData.Volume.Value if player.SongPlayerData.SongPlay.Value ~= nil then local find = script.Music:findFirstChild(player.SongPlayerData.SongPlay.Value) if find == nil then return end script.song.Value = find musicNow = script.song.Value musicNow.Pitch = songPitch musicNow.Volume = songVolume musicNow:Play() end end end
function this.PlaySong(so) local ss = script.Music:findFirstChild(so) if ss == nil then return end if musicNow == ss then return end if musicNow ~= nil then musicNow:Stop() end script.song.Value = ss musicNow = script.song.Value musicNow.Pitch = songPitch musicNow.Volume = songVolume musicNow:Play() player.SongPlayerData.SongPlay.Value = so end
function this.StopSong() if musicNow == nil then return end musicNow:Stop() script.song.Value = nil musicNow = nil player.SongPlayerData.SongPlay.Value = ""
end
function this.SetPitch(pit) songPitch = pit if musicNow == nil then return end musicNow.Pitch = songPitch end
function this.SetVolume(vol) songVolume = vol if musicNow == nil then return end musicNow.Volume = songVolume end
return this
-------------------------------------------------------- |
|
|
| Report Abuse |
|
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 20 Mar 2016 01:11 PM |
I don't understand, you've provided the answer to your own question.
What do you want from us :P |
|
|
| Report Abuse |
|
|
|
| 20 Mar 2016 01:15 PM |
I guess i did answer my own question but when i go to test this script in studio with the changes that are needed it doesn't fade in or fade out and there are no errors once so ever.
Basically i'm just wondering where i would place the Volume=0.1 (up to 1) and then back up in this script (A friend made this one for me but i'd like it to be improved) |
|
|
| Report Abuse |
|
|
EgoMoose
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 2896 |
|
|
| 20 Mar 2016 01:17 PM |
You'll need a for loop and the wait function (or some kind of yield).
http://wiki.roblox.com/index.php?title=Function_dump/Functions_specific_to_ROBLOX#Wait http://wiki.roblox.com/index.php?title=Loops#For |
|
|
| Report Abuse |
|
|
|
| 20 Mar 2016 01:29 PM |
Ok so i'm kinda confused, Would i need something like this?
---------(Fading into music)------ Volume=0.1 wait(0.1) Volume=0.2 wait(0.1) Volume=0.3 wait(0.1) Volume=0.4 --Exc---
And do the same thing for fading out but with the volume values going down from 1? |
|
|
| Report Abuse |
|
|
|
| 20 Mar 2016 01:56 PM |
| or you can make the music or edit it with ableton or audacity. |
|
|
| Report Abuse |
|
|
|
| 20 Mar 2016 02:11 PM |
| Yeah but i don't got enough robux to do that :P |
|
|
| Report Abuse |
|
|