You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am making a RNG game (gambling🤑) similar to Sols RNG -
What is the issue? Include screenshots / videos if possible!
Basically, after rolling the function gets an aura and waits till you press either button before sending the aura or that you skipped to the other function. That function doesn’t wait and gets nil as its result.
local highestAura = nil
local gen = 1
local cooldownDecreaser = 1
local luckMultiplier = 1
local rolling = false
local function roll(fake)
local result = math.random(1, 100 * gen)
local aura
script.Parent.Parent.AuraGained.Visible = true
script.Parent.Parent.AuraGained.Position = UDim2.fromScale(0.4, 0.6)
if result <= (1 * gen * luckMultiplier) then
aura = "Mythic"
script.Parent.Parent.AuraGained.Text = aura
script.Parent.Parent.AuraGained.Font = Enum.Font.JosefinSans
script.Parent.Parent.AuraGained.TextColor = BrickColor.new("Royal purple")
elseif result <= (5 * gen * luckMultiplier) then
aura = "Legendary"
script.Parent.Parent.AuraGained.Text = aura
script.Parent.Parent.AuraGained.Font = Enum.Font.Oswald
script.Parent.Parent.AuraGained.TextColor = BrickColor.new("Deep orange")
elseif result <= (25 * gen * luckMultiplier) then
aura = "Epic"
script.Parent.Parent.AuraGained.Text = aura
script.Parent.Parent.AuraGained.Font = Enum.Font.SourceSans
script.Parent.Parent.AuraGained.TextColor = BrickColor.new("White")
elseif result <= (50 * gen * luckMultiplier) then
aura = "Rare"
script.Parent.Parent.AuraGained.Text = aura
script.Parent.Parent.AuraGained.Font = Enum.Font.SourceSans
script.Parent.Parent.AuraGained.TextColor = BrickColor.new("White")
elseif result <= (75 * gen * luckMultiplier) then
aura = "Uncommon"
script.Parent.Parent.AuraGained.Text = aura
script.Parent.Parent.AuraGained.Font = Enum.Font.SourceSans
script.Parent.Parent.AuraGained.TextColor = BrickColor.new("White")
elseif result <= (100 * gen * luckMultiplier) then
aura = "Common"
script.Parent.Parent.AuraGained.Text = aura
script.Parent.Parent.AuraGained.Font = Enum.Font.SourceSans
script.Parent.Parent.AuraGained.TextColor = BrickColor.new("White")
end
local info = TweenInfo.new(0.1 * cooldownDecreaser, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut, 0, false, 0)
local position = {Position = UDim2.fromScale(0.4, 0.675)}
local tween = game.TweenService:Create(script.Parent.Parent.AuraGained, info, position)
tween:Play()
tween.Completed:Connect(function()
if fake ~= true then
script.Parent.Parent.EquipButton.Visible = true
script.Parent.Parent.SkipButton.Visible = true
script.Parent.Parent.SkipButton.Activated:Connect(function()
script.Parent.Parent.EquipButton.Visible = false
script.Parent.Parent.SkipButton.Visible = false
print("a")
return "Skipped"
end)
script.Parent.Parent.EquipButton.Activated:Connect(function()
script.Parent.Parent.EquipButton.Visible = false
script.Parent.Parent.SkipButton.Visible = false
print("b")
return aura
end)
end
end)
end
function fullRoll()
if not rolling then
rolling = true
for i = 1, 10 do
roll(true)
task.wait(0.2 / cooldownDecreaser)
end
local result = roll()
print(result)
repeat
task.wait()
until result ~= nil
print("done")
if result ~= "Skipped" then
print(result)
game.ReplicatedStorage.AuraFunction:InvokeServer(result)
end
task.wait(2 / cooldownDecreaser)
rolling = false
end
end
script.Parent.Activated:Connect(fullRoll)
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried searching across the dev forum, I also added a repeat loop waiting until the value changes but it doesn’t
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.