Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Destroyed Value still appears?

So, I've made a script that destroys a value once picked as I want to make a football draws place and therefore teams can't be repeated but once I destroy A value it still appears when clicked... Here's the script:

local tname = game.Workspace.DraW
local draw= game.workspace.DraW.UCLDraws
local teamselect = (tname.UCLTeams:GetChildren())





script.Parent.ONEDRAW.Triggered:Connect(function()
	local st = teamselect[math.random(1, #teamselect)]
	print(st)
	draw.Team1.SurfaceGui.Teams.THETEAM.Text = st.Value
	draw.Model.Ball1.Transparency = 1
	script.Parent.ONEDRAW.Enabled = false
	wait(0.1)
	script.Parent.ONEDRAW.Enabled = true
	wait()
	draw.Team1.SurfaceGui.Teams.THETEAM.TextTransparency = 0.8
	draw.Team1.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.8
	wait(0.1)
	draw.Team1.SurfaceGui.Teams.THETEAM.TextTransparency = 0.6
	draw.Team1.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.6
	wait(0.1)
	draw.Team1.SurfaceGui.Teams.THETEAM.TextTransparency = 0.4
	draw.Team1.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.4
	wait(0.1)
	draw.Team1.SurfaceGui.Teams.THETEAM.TextTransparency = 0.2
	draw.Team1.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.2
	wait(0.1)
	draw.Team1.SurfaceGui.Teams.THETEAM.TextTransparency = 0
	draw.Team1.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0
	wait(0.1)
	st:Destroy()
	st.Value = " "
	wait(5)
	script.Parent.ONEDRAW.Enabled = false
	wait(10)
	script.Parent.TWODRAW.Enabled = true
	wait(0.1)
end)


script.Parent.TWODRAW.Triggered:Connect(function()
	local st2 = teamselect[math.random(1, #teamselect)]
	print(st2)
	draw.Team2.SurfaceGui.Teams.THETEAM.Text = st2.Value
	draw.Model.Ball2.Transparency = 1
	wait(0.1)
	draw.Team2.SurfaceGui.Teams.THETEAM.TextTransparency = 0.8
	draw.Team2.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.8
	wait(0.1)
	draw.Team2.SurfaceGui.Teams.THETEAM.TextTransparency = 0.6
	draw.Team2.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.6
	wait(0.1)
	draw.Team2.SurfaceGui.Teams.THETEAM.TextTransparency = 0.4
	draw.Team2.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.4
	wait(0.1)
	draw.Team2.SurfaceGui.Teams.THETEAM.TextTransparency = 0.2
	draw.Team2.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.2
	wait(0.1)
	draw.Team2.SurfaceGui.Teams.THETEAM.TextTransparency = 0
	draw.Team2.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0
	wait(0.1)
	st2:Destroy()
	st2.Value = " "
	wait(25)
	script.Parent.TWODRAW.Enabled = false
	wait(2)
	script.Parent.THREEDRAW.Enabled = true
end)

script.Parent.THREEDRAW.Triggered:Connect(function()
	local st3 = teamselect[math.random(1, #teamselect)]
	print(st3)
	draw.Team3.SurfaceGui.Teams.THETEAM.Text = st3.Value
	draw.Model.Ball3.Transparency = 1	wait(0.1)
	script.Parent.THREEDRAW.Enabled = false
	wait(7)
	script.Parent.THREEDRAW.Enabled = true
	wait(0.1)
	draw.Team3.SurfaceGui.Teams.THETEAM.TextTransparency = 0.8
	draw.Team3.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.8
	wait(0.1)
	draw.Team3.SurfaceGui.Teams.THETEAM.TextTransparency = 0.6
	draw.Team3.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.6
	wait(0.1)
	draw.Team3.SurfaceGui.Teams.THETEAM.TextTransparency = 0.4
	draw.Team3.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.4
	wait(0.1)
	draw.Team3.SurfaceGui.Teams.THETEAM.TextTransparency = 0.2
	draw.Team3.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.2
	wait(0.1)
	draw.Team3.SurfaceGui.Teams.THETEAM.TextTransparency = 0
	draw.Team3.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0
	wait(0.1)
	st3:Destroy()
	st3.Value = " "
	wait(30)
	script.Parent.THREEDRAW.Enabled = false
	wait(2)
	script.Parent.LASTDRAW.Enabled = true
end)

script.Parent.LASTDRAW.Triggered:Connect(function()
	local st4 = teamselect[math.random(1, #teamselect)]
	print(st4)
	draw.Team4.SurfaceGui.Teams.THETEAM.Text = st4.Value
	draw.Model.Ball4.Transparency = 1
	wait(0.1)
	draw.Team4.SurfaceGui.Teams.THETEAM.TextTransparency = 0.8
	draw.Team4.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.8
	wait(0.1)
	draw.Team4.SurfaceGui.Teams.THETEAM.TextTransparency = 0.6
	draw.Team4.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.6
	wait(0.1)
	draw.Team4.SurfaceGui.Teams.THETEAM.TextTransparency = 0.4
	draw.Team4.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.4
	wait(0.1)
	draw.Team4.SurfaceGui.Teams.THETEAM.TextTransparency = 0.2
	draw.Team4.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0.2
	wait(0.1)
	draw.Team4.SurfaceGui.Teams.THETEAM.TextTransparency = 0
	draw.Team4.SurfaceGui.Teams.THETEAM.TextStrokeTransparency=0
	wait(0.1)
	st4:Destroy()
	st4.Value = " "
	wait(35)
	script.Parent.LASTDRAW.Enabled = false
end)

3 comments

0

Im not sure about the Value your talking about but I would suggest making a function out of those repeating sections of your code, it would make your code much shorer and easier to work with. If you dont know how to do this, I would suggest looking into it.

0

local st = teamselect[math.random(1, #teamselect)] and the other number st values, they appear on my table after they have been destroyed.

0

I fixed by updating the table after every value destroyed, as the table was not updated after destroying the value.

1 answer

I fixed by updating the table after every value destroyed, as the table was not updated after destroying the value.

This discussion is preserved as it was. New answers, comments, and votes are closed.