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

i don't know whats wrong it wont go the the random position how do i fix?

Asked by 5 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

local char = player.Character local hands = {char.LeftHand,char.RightHand} local q = Instance.new("BodyVelocity") local xclone = game.Lighting:WaitForChild("fireball"):Clone() xclone.Parent = workspace xclone.Position = math.random(1,#hands.Position)
1
Position takes a vector3 value. Theswagger66 54 — 5y
0
Position takes a vector3 value. Fifkee 2017 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

Create 3 values for X,Y, and Z.

local z = math.Random(1,#hands.Position)
local x = math.Random(1,#hands.Position)
local x = math.Random(1,#hands.Position)
xclone.Position = vector3.new(x,y,z)
Ad
Log in to vote
0
Answered by 5 years ago

you cannot random a vector3 value because it has 3 values in it.

so what you can do is,

xclone.Position = hands.Position + Vector3.new(math.random(-10, 10), 0, math.random(-10,10))

you can change all the 10s to whatever you like. but be careful of y, if you set too low, it may fall out of the world.

Answer this question