Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This opacity script isn't changing the opacity value at all?

Asked by 6 years ago
Edited 6 years ago

So I have this in a server script. What it aims to do is add an effect where it seems like a thing is disappearing when actually it's just changing the opacity and then unanchoring it. The unanchoring bit works fine but is it the bit where the change in opacity is worded incorrectly? I don't expect anyone to read this so all you have to do is look at the first bits and the last bit to see what I did wrong.

-- manual values
local ChangeMeA = game.Workspace.Partysarec.Transparency
local ChangeMeB = game.Workspace.P.Transparency
local ChangeMeC = game.Workspace.Pa.Transparency
local ChangeMeD = game.Workspace.Par.Transparency
local ChangeMeE = game.Workspace.Parte.Transparency
local ChangeMeF = game.Workspace.Party.Transparency
local ChangeMeG = game.Workspace.Partys.Transparency
local ChangeMeH = game.Workspace.Partysa.Transparency
local ChangeMeI = game.Workspace.Partysar.Transparency
    local ChangeMeJ = game.Workspace.Partysare.Transparency
local UNANCHORED = game.Workspace
-- script
ChangeMeA = 0
ChangeMeB = 0
ChangeMeC = 0
ChangeMeD = 0
ChangeMeE = 0
ChangeMeF = 0
ChangeMeG = 0
ChangeMeH = 0
ChangeMeI = 0
ChangeMeJ = 0
wait(0.15)
ChangeMeA = 0.05
ChangeMeB = 0.05
ChangeMeC = 0.05
ChangeMeD = 0.05
ChangeMeE = 0.05
ChangeMeF = 0.05
ChangeMeG = 0.05
ChangeMeH = 0.05
ChangeMeI = 0.05
ChangeMeJ = 0.05
wait(0.15)
ChangeMeA = 0.1
ChangeMeB = 0.1
ChangeMeC = 0.1
ChangeMeD = 0.1
ChangeMeE = 0.1
ChangeMeF = 0.1 
ChangeMeG = 0.1
ChangeMeH = 0.1
ChangeMeI = 0.1
ChangeMeJ = 0.1
wait(0.15)

-- 10 years later after 200 lines of code in transparency increments of 0.05

wait(0.15)
ChangeMeA = 0.95
ChangeMeB = 0.95
ChangeMeC = 0.95
ChangeMeD = 0.95
ChangeMeE = 0.95
ChangeMeF = 0.95
ChangeMeG = 0.95
ChangeMeH = 0.95
ChangeMeI = 0.95
ChangeMeJ = 0.95
wait(0.15)
ChangeMeA = 1
ChangeMeB = 1
ChangeMeC = 1
ChangeMeD = 1
ChangeMeE = 1
ChangeMeF = 1
ChangeMeG = 1
ChangeMeH = 1
ChangeMeI = 1
ChangeMeJ = 1
UNANCHORED.P.Anchored = false
UNANCHORED.Pa.Anchored = false
UNANCHORED.Par.Anchored = false
UNANCHORED.Parte.Anchored = false
UNANCHORED.Party.Anchored = false
UNANCHORED.Partys.Anchored = false
UNANCHORED.Partysa.Anchored = false
UNANCHORED.Partysar.Anchored = false
UNANCHORED.Partysare.Anchored = false
UNANCHORED.Partysarec.Anchored = false

okay so this is it if you read everything you wasted a lot of time. and yes this was VERY painful to type out and I'm sure everyone out there with better knowledge than me could do this within 20 lines. Thanks anyone for help I appreciate it. I had to manually indent all this for this question ;-; just imagine 200 more lines all the same ChangeMeX = -value-.

notes:

  • server script

  • manually changes every block in the workspace non of them are grouped.

  • Unanchoring works so this has lead me to believe it's the wrong variable?

  • No errors in the output

and that's about it I think. Thanks everyone for their answers. I'm sure I missed out some important info. If you leave a note asking for it I should be on this thread for the next 20-30 mins.

Edit: bad grammar

1 answer

Log in to vote
1
Answered by 6 years ago

The error is at the part where you use the number to change the opacity ChangeMeA = 0 just sets the value of the variable ChangMeA to the number 0, not actually setting the opacity of it. Instead, you should remove the word transparency in all of the variables, and put the .Transparency in front of all the "ChangeMe" stuff. (What I would've done:)

-- manual values
local ChangeMeA = game.Workspace.Partysarec
local ChangeMeB = game.Workspace.P
local ChangeMeC = game.Workspace.Pa
local ChangeMeD = game.Workspace.Par
local ChangeMeE = game.Workspace.Parte
local ChangeMeF = game.Workspace.Party
local ChangeMeG = game.Workspace.Partys
local ChangeMeH = game.Workspace.Partysa
local ChangeMeI = game.Workspace.Partysar
    local ChangeMeJ = game.Workspace.Partysare
local UNANCHORED = game.Workspace
-- script
ChangeMeA.Transparency = 0
ChangeMeB.Transparency = 0
ChangeMeC.Transparency = 0
ChangeMeD.Transparency = 0
ChangeMeE.Transparency = 0
ChangeMeF.Transparency = 0
ChangeMeG.Transparency = 0
ChangeMeH.Transparency = 0
ChangeMeI.Transparency = 0
ChangeMeJ.Transparency = 0
wait(0.15)
ChangeMeA.Transparency = 0.05
ChangeMeB.Transparency = 0.05
ChangeMeC.Transparency = 0.05
ChangeMeD.Transparency = 0.05
ChangeMeE.Transparency = 0.05
ChangeMeF.Transparency = 0.05
ChangeMeG.Transparency = 0.05
ChangeMeH.Transparency = 0.05
ChangeMeI.Transparency = 0.05
ChangeMeJ.Transparency = 0.05
--you get the idea now

I'll have an expert compress this code better, because the only method i can think of just does it 1 at a time.

0
@OP accept this answer User#19524 175 — 6y
Ad

Answer this question