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

Why is this not working? the value doesn't go up but it prints check...

Asked by 5 years ago

I'm confused why it's still not working the problem is the value doesn't go up but the stuff gets printed... like it says check for the print"check")

local v = game.Lighting:WaitForChild("ONE")
local sway = math.random(1, 100) * math.random(0.05, 0.15)
local y = math.random(1,10)
local x = math.random(1,1)
while wait() do
y=math.random(1,10)
wait(15)

print("Changing Values...")
v.Value = v.Value + sway

if y == 5 then
    v.Value = v.Value * 1.1 * math.random(1.7, 2.1)
    print("Multiplied ONE")
    elseif y == 6 then 
        v.Value = v.Value - v.Value + 2.50
        print("ONE just crashed!!!")
        elseif y == 6 then 
        v.Value = v.Value + sway
        print("check")
        elseif y == 7 then 
    v.Value = v.Value + sway
        print("check")
        elseif y == 8 then 
    v.Value = v.Value + sway
    print("check")
        elseif y == 9 then 
    v.Value = v.Value + sway
    print("check")
        elseif y == 10 then 
    v.Value = v.Value + sway
    print("check")
        elseif y == 4 then 
    v.Value = v.Value + sway
    print("check")
        elseif y == 3 then 
    v.Value = v.Value + sway
    print("check")
        elseif y == 2 then 
    v.Value = v.Value + sway
    print("check")
        elseif y == 1 then 
    v.Value = v.Value + sway
    print("check")
end
end

0
wait 6 is there twice lol... idk if thats the problem but i'll see JohnerDev 27 — 5y
0
nvm didn't work JohnerDev 27 — 5y
0
elseif y == 6 then v.Value = v.Value - v.Value + 2.50 print("ONE just crashed!!!") elseif y == 6 then v.Value = v.Value + sway print("check") JohnerDev 27 — 5y
0
i fixed that but still didn't work value didn't change JohnerDev 27 — 5y

1 answer

Log in to vote
0
Answered by
Sir_Melio 221 Moderation Voter
5 years ago

I don't think math.random accepts decimals as arguments. Use Random.new instead, like so:

local ran = Random.new()

local sway = ran:NextNumber(0.05, 15)

You can read the wiki about the Random datatype here.

0
lol what i have now works without Random.new JohnerDev 27 — 5y
0
But thanks anyway JohnerDev 27 — 5y
Ad

Answer this question