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

Using random, how would I make a part change its x,z move randomly within 10 studs?

So I'm not sure how to use random. Please explain how I would let the y stay the same but the x and z change by a random amount but within a range.

1 answer

Use math.random() in only the x and y positions of the Vector3.

part = game.Workspace.PARTLOCATION
game.Workspace.Part.Position = Vector3.new(part.Position.X + math.random(-10,10), part.Position.Y, part.Position.Z + math.random(-10,10))

2 comments

0

Hey thanks. You've been really helpfull today!

0

No problem!

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