Cant use math.noise

so i want to make a 10 by 10 grid that makes waves using math.noise

the creating parts script

function create_parts()
	for x = 0,10,1 do
		for y = 0,10,1 do
			local part = Instance.new("Part")
			part.Anchored = true
			part.Position = Vector3.new(x,y,0)
			part.Size = Vector3.new(1,1,1)
			part.Name = "moveable"
			part.Parent = workspace
		end
	end
end

the fourmla

v.Position = Vector3.new(v.Position.X,v.Position.Y,math.noise(v.Position.X+repeats))

For some reason it only return 0

Using math.noise with 3 integers will always return 0, per the documentation:

If x, y, and z are all integers, the return value will be 0.

The most common way to fix this is by dividing the parameters by a resolution, for example:

local RESOLUTION = 64
(v.Position.X + repeats) / RESOLUTION

image
image

You are trying to divide 0 by 64. Rewrite the line like this:

print(math.noise( (v.Position.X + repeats) / 64))

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.