|
| 18 Aug 2016 05:27 PM |
So I'm trying to make a Part that's visible and cancollide, then fades and cancollide is turned to false, then the object fades into transparency
How would I call a function in the middle of this code to make a sound play when it fades in and out of visibility?
function soundz() game.Workspace.Part.Sound:Play() end
function soundoffz() game.Workspace.Part.Sound:Pause() end
while true do game.Workspace.Part.Transparency = 0 wait(0.1) game.Workspace.Part.Transparency = 0.1 wait(0.1) game.Workspace.Part.Transparency = 0.2 wait(0.1) game.Workspace.Part.Transparency = 0.3 wait(0.1) game.Workspace.Part.Transparency = 0.4 wait(0.1) game.Workspace.Part.Transparency = 0.5 wait(0.1) game.Workspace.Part.Transparency = 0.6 wait(0.1) game.Workspace.Part.Transparency = 0.7 wait(0.1) game.Workspace.Part.Transparency = 0.8 wait(0.1) game.Workspace.Part.Transparency = 0.9 wait(0.1) game.Workspace.Part.Transparency = 1 game.Workspace.Part.CanCollide = false wait(3) game.Workspace.Part.Transparency = 0.9 wait(0.1) game.Workspace.Part.Transparency = 0.8 wait(0.1) game.Workspace.Part.Transparency = 0.7 wait(0.1) game.Workspace.Part.Transparency = 0.6 wait(0.1) game.Workspace.Part.Transparency = 0.5 wait(0.1) game.Workspace.Part.Transparency = 0.4 wait(0.1) game.Workspace.Part.Transparency = 0.3 wait(0.1) game.Workspace.Part.Transparency = 0.2 wait(0.1) game.Workspace.Part.Transparency = 0.1 wait(0.1) game.Workspace.Part.Transparency = 0 game.Workspace.Part.CanCollide = true wait(3) end |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 05:28 PM |
| I forget how to call functions sorry |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 05:29 PM |
1.) ew ew ew ew ew
for i=1,0,-1/30 do transparency = i end
2.)
function()
lol |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Aug 2016 08:17 PM |
bump for blarg to respond
Hey Blarg, I didn't use your code but I figured it out in time. Sorry for responding so late my monitor is really faulting right now,
My code will be long until I get really advanced at Lua so it's pretty depressing xD |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 08:25 PM |
| if you think you are writing bad code, you probably are, in that case there is most-likely a better solution. |
|
|
| Report Abuse |
|
|