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

Is there something wrong with the function math.noise()?

Is math.noise() broken? I've tried using it with different parameters but it just gives back 0 for all of them. Isn't it supposed to give a value between 0 and 1?

3 comments

2

It doesn't appear to be broken for me. Keep in mind that if all of the parameters are integers, the return value will always be 0. Also, it will generate a value between -1 and 1.

0

I thought it was -0.5, 0.5.

0

james is right, noise is meant to take parameter from a previous noise value, right? So the parameter has to be a decimal.

1 answer

If you're trying to generate a height / Y coordinate in an XYZ 3d space then for every x and z value introduced, you should divide it until it's between -1 and 1. Something like this.

height = math.noise( x/60, z/60 ) * 50 -- this will give you some pretty smooth terrain

Another thing to look out for: DO NOT use too high of a value. If you want to make a big map, use a 100x100 map at most. After 100x100 it causes a lot of server lag. If you have the builing blocks size set to 1,1,1 you might want to set the size to 10,height,10. and the cframe also multiplies with each x and z like this:

NewPart.CFrame = CFrame.new(Vector3.new(10*x, height, 10*z))

1 comment

0

sorry for necroposting btw

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