local pos1 = {250, 0, 250} local pos2 = {-250, 0, -250} game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function() local part = Instance.new("Part", game.Workspace) part.Anchored = true part.Position = Vector3.new(math.random(#pos1, #pos2)) end) end)
I am struggling please help.
This should work
--Must go from low to high x = math.random(0,100) y = math.random(0,100) z = math.random(0,100) game.Players.PlayerAdded:Connect(function(Player) Player.Chatted:Connect(function() local part = Instance.new("Part", game.Workspace) part.Anchored = true part.Position = Vector3.new(x,y,z) end) end)
--pos1 dictionary-- local pos1 = { 250, 0, 250 } --pos2 dictionary-- local pos2 = { -250, 0, -250 } game.Players.PlayerAdded:Connect(function(plr) --when player chats plr.Chatted:Connect(function() local part = Instance.new("Part", game.Workspace) -- new part created to workspace-- part.Anchored = true part.Position = Vector3.new(math.random(pos2[1], pos1[1]), math.random(pos1[2], pos2[2]), math.random(pos2[3], pos1[3])) --first argument is the X axis (also the math.random goes to lowest to highest like how KripticalYT said), second argumest is the Y axis, the third one is the Z axis.-- end) end)