Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the script not choosing a number between what I am asking it to?

Asked by 5 years ago
Edited 5 years ago

Why is the script when it is doing something like for i, s choosing a number not in between what I am allowing it too? Doing math.random(5,15) isnt changing anything

enter code herescript.Parent.MouseButton1Click:Connect(click)`local player = game.Players.LocalPlayer

local stats = player:WaitForChild("leaderstats")

local z = 5

local b = 2

local noc = 0

local me = script.Parent.Parent.Parent

local nope = script.Parent.Parent.Parent

function click()

local ice = 0

local n = script.Parent.Parent

local i = 0

if script.Parent.Visible == true and stats.Views.Value >= 5 then

stats.Views.Value = stats.Views.Value - 5

local y = math.random(15)

local a = math.random(8)

n.Cav.Visible = false

n.computer.Visible = false

n.bill.Visible = false

n.fpc.Visible = false

n.micro.Visible = false

script.Parent.Parent.pow.Visible = false

script.Parent.Parent.sap.Visible = false

script.Parent.Parent.Parent.tutorial.Visible = false

script.Parent.Parent.Parent.Parent.Parent.Parent.pew.Visible = false

script.Parent.Visible = false

nope.prog.Text = "Filming"

wait(0.3)

nope.prog.Text = "Filming."

wait(0.3)

nope.prog.Text = "Filming.."

wait(0.3)

nope.prog.Text = "Filming..."

wait(2)

nope.prog.Text = "Editing"

wait(0.3)

nope.prog.Text = "Editing."

wait(0.3)

nope.prog.Text = "Editing.."

wait(0.3)

nope.prog.Text = "Editing..."

wait(2)

nope.prog.Text = "Publishing"

wait(0.3)

nope.prog.Text = "Publishing."

wait(0.3)

nope.prog.Text = "Publishing.."

wait(0.3)

nope.prog.Text = "Publishing..."

wait(0.3)

nope.prog.Text = "Published"

wait(0.2)

script.Parent.Parent.Parent.no.POT.Visible = true

for x = 5,y do

i = i + 1

stats.Views.Value = stats.Views.Value + 1

script.Parent.Parent.Parent.no.POT.Text = "Views: ".. i

wait(0.6)

end

script.Parent.Parent.Parent.no.pot.Visible = true

for s = 2,a do

ice = ice + 1

script.Parent.Parent.Parent.no.pot.Text = "Subscribers: ".. ice

stats.Subscribers.Value = stats.Subscribers.Value + 1

wait(0.6)

end

wait(2)

script.Parent.Parent.Parent.no.pot.Visible = false

script.Parent.Parent.Parent.no.POT.Visible = false

local q = script.Parent.Parent.Parent

q.animals.Visible = true

q.gaming.Visible = true

q.clickbait.Visible = true

q.tutorial.Visible = true

q.unbox.Visible = true

script.Parent.Parent.Parent.Parent.Parent.Parent.pew.Visible = true

end

end

script.Parent.MouseButton1Click:Connect(click)`

0
The number generated has a possibility of being below 5, thus breaking the loop. Change math.random(15) to math.random(6, 15). DeceptiveCaster 3761 — 5y
0
its still putting a different number Zeppelin0330 38 — 5y

Answer this question