Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with math.random?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

I am not good with math.random() This works but I want the part to be everywhere.

    --\\Made by PreyStar//--
--I am not good w/ math.random()--

while true do
    wait(1)
    Part = Instance.new("Part", game.Workspace)
    Part.Anchored = true
    Part.Position = Vector3.new(math.random(100))

end
0
This Question has been answered multiple times, please use the Websites search engine to see if your Question has already been answered. :) Search Engine - https://scriptinghelpers.org/search TheeDeathCaster 2368 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

You need to add another value to compare it to, 1,100 would get a random value between 1 and 100. You also need to add it 2 more time's since there's a X Y and Z value in Position's.

Sorry I can't explain it any better. =\

    --\\Made by PreyStar//--
--I am not good w/ math.random()--

while wait(1) do -- Replaced while true do with while wait(1) do
    Part = Instance.new("Part", game.Workspace)
    Part.Anchored = true
    Part.Position = Vector3.new(math.random(1,100),math.random(1,100),math.random(1,100))
end
Ad

Answer this question