Why does GUI transparency go to 0 when it's not supposed to?

  1. What do you want to achieve? A Gui effect that changes the transparency of a GUI randomly (using math.random)

  2. What is the issue? The function looks right but when I run it, it just changes the transparency to 0

  3. What solutions have you tried so far? I’ve tried looking at the GUI API’s but nothing has been helpful

here’s the function

local function SpellEffect(plr)
	for count = 1,5 do
		plr.PlayerGui.SpellEffect.Frame.BackgroundTransparency = math.random(0.4,0.8)
		wait(0.2)
	end
end

all help is appreciated

1 Like

Math.random() can’t generate decimal number (or that what I know) try this instead

local randomNum = Random.new()
local function SpellEffect(plr)
	for count = 1,5 do
		plr.PlayerGui.SpellEffect.Frame.BackgroundTransparency = randomNum:NextNumber(0.4,0.8)
		wait(0.2)
	end
end
2 Likes