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

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

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

4 comments

0

wait 6 is there twice lol... idk if thats the problem but i'll see

0

nvm didn't work

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")

0

i fixed that but still didn't work value didn't change

1 answer

✓ Accepted answer

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.

3 comments

0

lol what i have now works without Random.new

0

But thanks anyway

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