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

I'm making to make this Part move to a random location, but it doesn't work anymore, Help?

I'm trying to make a game where when you touch a Part it will move to a random location, it used to work, and now it doesn't. I am unsure of why. Please take a look at my code below, Thanks!

Part = game.Workspace.Brick1
function RandMove()
	Part.Position = Vector3.new(Random.new(1),5,Random.new(1))
end

RandMove()

touched = Part.Touched:Connect(RandMove)

1 comment

0

Use math.random(start, end)

1 answer

✓ Accepted answer

Hello, wolverhulk15!

I just changed Random.new to math.random, as random.new just sets a random seed

Part = game.Workspace.Brick1
function RandMove()
    randomseed(os.time()) -- Changes the random seed
    Part.Position = Vector3.new(math.random(0, 1), 5, math.random(0, 1))
end

RandMove()

touched = Part.Touched:Connect(RandMove)

3 comments

0

tysm!

1

please accept the answer

0

sorry, im new to this. :P

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