UI Gradiant is enabled even if the "enabled" is false

, ,

Hi! I am here to get some help on something I don’t understand. I got an “UI Gradiant” on some text to make them a little more nice, and that’s not the problem. The problem is that when I disable my UI Gratiant with my script in-game, the colors of the UI Gradiant are active even if when I look for the enable its false. An exemple :


Normally its like that :
image
(btw the + is just a little rarer, thats the same color as an uncommon without +)

Here the script with the disable system (and other things) :

local TS = game:GetService("TweenService")

local button = script.Parent
local rolling = script.Parent.Parent.Parent.Rolling
local text = rolling.Aura
local chancetext = rolling.Aura.Chance
local scroll = script.click
local first = script["1 - 999"]
local second = script["1k - 100k"]

local chosenaura
local luck
local good = false

local textpos = text.Position

local tweeninfo = TweenInfo.new(0.2, 9)

local gradiants = rolling.Aura:FindFirstChildOfClass("UIGradient")
local rage = rolling.Aura.RageGradiant
local sus = rolling.Aura.SusGradiant

local auras = {
	["Common"] = 2,
	["Uncommon"] = 4,
	["Rare"] = 6,
	["Epic"] = 10,
	["Common +"] = 25,
	["Uncommon +"] = 35,
	["Rare +"] = 50,
	["Sus"] = 69,
	["Epic +"] = 80,
	["Rage"] = 99,
	["Legendary"] = 200,
	["Mythic"] = 250,
	["Mystic"] = 300,
	["Copper"] = 400,
	["Silver"] = 450,
	["Gold"] = 500,
	["Diamond"] = 555,
	["Evil"] = 666,
	["Luck"] = 777,
	["Star"] = 800,
	["Starlight"] = 999,
	["Astral"] = 1000,
	["Moon"] = 1150,
	["Sun"] = 1300,
	["Earth"] = 1500,
}

local function Luck()
	for _, chance in pairs(auras) do
		local number = math.random(1, chance)
		if number == chance then
			print(chance)
			print(_)
			print(number)
			chosenaura = _
			luck = chance
			good = true
			break
		end
		task.wait()
	end
end

button.Activated:Connect(function()
	
	button.Parent.Enabled = false
	
	Luck()
	
	local times = 9
	local waiting = 0.1
	
	rolling.Enabled = true
	
	repeat
		local random = math.random(1, 4)
		if random == 1 then
			text.Text = "Common"
			chancetext.Text = "1 / 2"
			text.TextColor3 = Color3.fromRGB(255, 255, 255)
		elseif random == 2 then
			text.Text = "Uncommon"
			chancetext.Text = "1 / 4"
			text.TextColor3 = Color3.fromRGB(119, 255, 153)
		elseif random == 3 then
			text.Text = "Rare"
			chancetext.Text = "1 / 6"
			text.TextColor3 = Color3.fromRGB(71, 114, 255)
		elseif random == 4 then
			text.Text = "Epic"
			chancetext.Text = "1 / 10"
			text.TextColor3 = Color3.fromRGB(213, 114, 255)
		end
		text.Position = textpos + UDim2.new(0, 0, 0, -50)
		local tween = TS:Create(text, tweeninfo, {Position = textpos + UDim2.new(0, 0, 0, 0)})
		tween:Play()
		
		scroll:Play()
		
		times -= 1
		wait(waiting)
		waiting += 0.03
	until times == 0
	
	if good == true then
		if luck <= 1000 then
			text.Text = chosenaura
			if chosenaura == "Common" then
				text.TextColor3 = Color3.fromRGB(255, 255, 255)
			elseif chosenaura == "Uncommon" then
				text.TextColor3 = Color3.fromRGB(119, 255, 153)
			elseif chosenaura == "Rare" then
				text.TextColor3 = Color3.fromRGB(71, 114, 255)
			elseif chosenaura == "Epic" then
				text.TextColor3 = Color3.fromRGB(213, 114, 255)
			elseif chosenaura == "Common +" then
				text.TextColor3 = Color3.fromRGB(255, 255, 255)
			elseif chosenaura == "Uncommon +" then
				text.TextColor3 = Color3.fromRGB(119, 255, 153)
			elseif chosenaura == "Rare +" then
				text.TextColor3 = Color3.fromRGB(71, 114, 255)
			elseif chosenaura == "Sus" then
				sus.Enabled = true
			elseif chosenaura == "Epic +" then
				text.TextColor3 = Color3.fromRGB(213, 114, 255)
			end
			chancetext.Text = "1 / "..luck
			text.Position = textpos + UDim2.new(0, 0, 0, -50)
			local tweeninfo = TweenInfo.new(0.8, 9)
			local tween = TS:Create(text, tweeninfo, {Position = textpos + UDim2.new(0, 0, 0, 0)})
			tween:Play()
			first:Play()
			good = false
		end
	else
		text.Text = "Common"
		chancetext.Text = "1 / 2"
		text.TextColor3 = Color3.fromRGB(255, 255, 255)
		text.Position = textpos + UDim2.new(0, 0, 0, -50)
		local tweeninfo = TweenInfo.new(0.8, 9)
		local tween = TS:Create(text, tweeninfo, {Position = textpos + UDim2.new(0, 0, 0, 0)})
		tween:Play()
		first:Play()
		good = false
	end
	
	wait(2)
	
	gradiants.Enabled = false
	
	rolling.Enabled = false
	button.Parent.Enabled = true
end)

Thanks if you help me :smiley:

1 Like

You’re checking inside the StarterGui, not the PlayerGui.

Check if it’s enabled inside Players > SkaleKill > PlayerGui

1 Like

It was just that, thanks for all ^^

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.