I have made a random generator to make a red or green block appear but it won't show the block or always is Red and it's not changing no matter how many time's I click it. Here is my **Script **
local RN = math.random (1, 2)
local GB = script.Parent.GreenButton
local RB = script.Parent.RedButton
GB.ProximityPrompt.Triggered:Connect(function()
if RN == 2 then
script.Parent.RedBlock.Transparency = 0
GB.ProximityPrompt.Archivable = false
wait(5)
script.Parent.RedBlock.Transparency = 1
GB.ProximityPrompt.Archivable = true
end
end)
RB.ProximityPrompt.Triggered:Connect(function()
if RN == 2 then
script.Parent.RedBlock.Transparency = 0
GB.ProximityPrompt.Archivable = false
wait(5)
script.Parent.RedBlock.Transparency = 1
GB.ProximityPrompt.Archivable = true
end
end)
GB.ProximityPrompt.Triggered:Connect(function()
if RN == 1 then
script.Parent.RedBlock.Transparency = 0
GB.ProximityPrompt.Archivable = false
wait(5)
script.Parent.RedBlock.Transparency = 1
GB.ProximityPrompt.Archivable = true
end
end)
RB.ProximityPrompt.Triggered:Connect(function()
if RN == 2 then
script.Parent.RedBlock.Transparency = 0
GB.ProximityPrompt.Archivable = false
wait(5)
script.Parent.RedBlock.Transparency = 1
GB.ProximityPrompt.Archivable = true
end
end)

1 comment
now it's just picking the color I pick I wan't it to be random