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

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


	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)

2 comments

1

Position takes a vector3 value.

0

Position takes a vector3 value.

2 answers

✓ Accepted answer

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)

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.

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