Issue with spin system

I’m trying to make a spinning system where players can spin and get a random power, it generates through random numbers and then shows what you got, it works the first time but then when you spin again the gui that says what you got doesn’t show up again after you click the close button, these are my scripts:

Local Script:
local db = false
script.Parent.MouseButton1Click:Connect(function()
if not db then
db = true
script.RemoteEvent:FireServer()
wait()
db = false
end
end)

Normal Script:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
local char = plr.Character
local root = char.HumanoidRootPart
local hum = char.Humanoid
local plrgui = plr.PlayerGui
local screen = plrgui.LuckSpinGUI.SpinButton
local p = game.Lighting.PowerScripts
local val = screen.LuckScript.Object
local gui = plrgui.PrizeScreenGUI
local text = gui.CongratsText
local prize = gui.PrizeText
local yg = gui.YouGotText
local close = gui.Close

for i = 1,40,1 do
	local r = math.random(1,11)
	val.Value = r
	script.Parent.Parent.Text = r
	wait(0.01)
end


if val.Value == 1 then
	p.AwakenScript:Clone().Parent = char
	text.Visible = true
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	prize.Text = "Full Cowling!"
elseif val.Value == 2 then
	p.FirstDarkScript:Clone().Parent = char
	text.Visible = true
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	prize.Text = "Darkness!"
elseif val.Value == 3 then
	p.GodSpeed:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "GodSpeed!"
elseif val.Value == 4 then
	p.PainPull:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Pain's Pull!"
elseif val.Value == 5 then
	p.PunchSlam:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Super Strength!"
elseif val.Value == 6 then
	p.SharinganActivScript:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Sharingan"
elseif val.Value == 7 then
	p.Sixfold:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Sixfold!"
elseif val.Value == 8 then
	p.SpiritBombScript:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Spirit Bomb!"
elseif val.Value == 9 then
	p.TitanShift:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Titan Shifting!"
elseif val.Value == 10 then
	p.mountscript:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Ice Powers!"
elseif val.Value == 11 then
	p.GojoScripts.CollapsingBlue:Clone().Parent = char
	p.GojoScripts.HollowPurpleAc:Clone().Parent = char
	p.GojoScripts.ReversalRedAc:Clone().Parent = char
	prize.Visible = true
	yg.Visible = true
	close.Visible = true
	text.Visible = true
	prize.Text = "Gojo!"
end

end)

Close Button Script:
local frame = script.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()

frame.CongratsText.Visible = false

frame.PrizeText.Visible = false

frame.Close.Visible = false

frame.YouGotText.Visible = false

end)

I appreciate any help I get and I hope whoever’s reading this has a great day!

Is your normal script the script shows what you have earned from the spin?

close.Visible = true
text.Visible = true
prize.Text = "Titan Shifting!"

Do you have any errors or anything else occuring?

1 Like

Yes it’s supposed to pop up and show what you’ve got, there are no errors but it doesnt work

1 Like

I think I narrowed in on what’s supposed to work. can you show me the lines that …

1 Like

I changed my script a bit and it works but is there any way to make it manual:
if val.Value == 3 then
gui.Enabled = true – This is a screengui
text.Text = “Pains Pull!”
p.PainPull:Clone().Parent = char
wait(2)
gui.Enabled = false
end

1 Like

What do you mean manual-like via function? If so…

using a function you can do this

function spinReveal(Obtained)
coroutine.wrap(function()
      gui.Enabled = true 
      text.Text = Obtained
      wait(2)
     gui.Enabled = false
end)()
end

Example

if val.Value == 3 then
spinReveal("Pains Pull!")
p.PainPull:Clone().Parent = char-
end