Hello all! Been a while, eh? lol
Today I tried to code a menu so that it fades in & out, but the numbers keep returning -inf and -nan(ind) which I have no clue why, as it seemed like I set up everything like I usually do. Any ideas why it's doing this?
teh code m8s:
local plr = game:GetService('Players').LocalPlayer
local md = script.Parent:WaitForChild('MD') -- Menu Displayer
local oc = script.Parent:WaitForChild('OC') -- Open/Close Button
local open = false
function transin(s, e, i, g) -- Transition: Start, End, Iteration #, GUI
spawn(function()
for x = s, e, i or 1 do
pcall(function() g.TextTransparency = .2*(x/e) end)
pcall(function() g.TextStrokeTransparency = .8*(x/e) end)
g.BackgroundTransparency = (s/e)*x
wait(1/44)
end
end)
end
function transout(s, e, i, g)
spawn(function()
for x = s, e, i or 1 do
print(s,e,i,x,x/s,1-(.7*(x/e))) -- To check what was going on.
pcall(function() g.TextTransparency = .2+(x/s) end)
pcall(function() g.TextStrokeTransparency = .8+(x/s) end)
g.BackgroundTransparency = 1-(.7*(x/e))
wait(1/44)
end
end)
end
local deb = true
oc.MouseButton1Click:Connect(function()
if not deb then return end deb = false
if open then
md.Visible = true
transin(0, 20, 1, md)
else
transout(20, 0, -1, md)
md.Visible = false
end
open = not open
wait(2.5)
deb = true
end)
Thanx for reading. c: & please let me know if any more info is needed. C:

1 comment
meep